F
Filamentβ€’11mo ago
SirFat

Route Parameters and Multi-Tenancy

Hiya! I'm attempting to put together Multi-Tenancy in Laravel10/Filament3 - I am following the guide on Filaments website, but I have a couple of roadblocks where this newbie is at a loss. Apologies if they are silly questions. I'm learning! * As instructed I created the register page in Pages/Tenancy/ - but as it appears far removed from 'Page' it doesn't support navigation discovery magic - so I've had to build a route manually into the page. * Now I have the AdminPanelProvider setting a tenant -pages which are auto-discovered don't have the 'tenant' parameter being passed through. "Missing required parameter for [Route: filament.admin.pages.verizon] [URI: admin/{tenant}/verizon] [Missing parameter: tenant]" * I bound the tenantProfile to the edit page in panel as described, but I then receive Route [filement.admin.tenant.profile] not defined.
6 Replies
krekas
krekasβ€’11mo ago
for the profile you need specify to use new url
SirFat
SirFatβ€’11mo ago
From what I can see, the URLs are being auto-generated when it's dynamically loading all the pages though. Do I have to teach the discovery process something?
SirFat
SirFatβ€’11mo ago
Thanks - I will have a read I have added the URL modification and although in a circumstance it still complained of a missing parameter, but the rest work, it could have been (now) a cache issue. The tenant is now being passed through file. Only challenge now is the tenant is being bound to every CRUD page, when I have some CRUD pages which are designed to be internal and will not require a client relationship: "The model [App\Models\Permission] does not have a relationship named [client]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [App\Filament\Resources\PermissionResource] resource class." I tried playing around with $tenantOwnershipRelationshipName - and it was looking at that variable, but I would presume there is a more elegant way of saying this model-does-not-apply. Thanks for the help! Ah, found it - appears the 'register new client' link in the tenancy selector is not passing the parameter, so it must be being set another way rather than the panel.
Dor Meljon
Dor Meljonβ€’11mo ago
what was your solution? it looks for "client" relation on every resource i have, even though those resources and not related to clients.
SirFat
SirFatβ€’11mo ago
Hey Dor, I didn't actually get a solution, so instead I have attempted to pose the question in another potentially clearer way as it may have been lost in the original intention of this one. See https://discord.com/channels/883083792112300104/1148084975795720212 because it isn't just limited to 'resources' - general 'pages' appear afflicted by the same issue, at least when processed like the livewire 'register you client' starting point is used. You can see the behaviour here: https://development.asmorphic.com/admin/ user admin@example.com pwd 12345678 (don't worry, no sensitive info there) You'll see that if you click 'Verizon' or 'Helix' the interface component (Livewire in the case of Verizon) - but if you select the admin dropdown and select 'register new client' you'll receive an error saying it's looking for
Missing required parameter for [Route: filament.admin.pages.helix] [URI: admin/{tenant}/helix] [Missing parameter: tenant].
Missing required parameter for [Route: filament.admin.pages.helix] [URI: admin/{tenant}/helix] [Missing parameter: tenant].
Which oddly, is the same thing that happened when I temporarily changed the path from 'admin' to 'app' I'll keep digging, but I first want to understand the quickest path to putting in a field with a 'verify' button/action next to it that fires off a request and waits for the answer - so trying to figure out the best guide to that problem πŸ˜‰
Want results from more Discord servers?
Add your server
More Posts