Getting a 404 when trying to register a tenant
I'm trying to enable the tenant registration feature in one of my panels but I'm getting a 404 when I try to access the page:
No query results for model [App\Models\Customer] new
Here is the code from my panel:
The route is listed as expected:
GET|HEAD app/new .................... filament.customer.tenant.registration › App\Filament\Customer\Pages\RegisterCustomer
Any idea why there is a query being made for this customer model?10 Replies
Because it’s your tenant. And with tenancy it has to query for it in order to scope the app.
I'm not following. Shouldn't the
app/new
route be exempt from looking up a tenant (the Customer
model in my case)? I would assume that using the tenantRegistration
method would prevent a lookup from happening
I get that the app needs to be scoped but I should be able to create new tenants alsoin that case you would create a different panel that doesn't use tenancy, then you could have a tenant resource on that panel.
I'm looking at this documentation: https://filamentphp.com/docs/3.x/panels/tenancy#adding-a-tenant-registration-page
It isn't entirely clear but I've assumed that the example has the
RegisterTeam
class being added to a TeamPanelProvider
. If that assumption is correct, I shouldn't have to create a different panel for the sake of creating tenants.Right, but that registration page is for users to create a tenant if they are not already part of one. If you need a way for an administrator to create tenants then you’ll need a page / panel that isn’t scoped by the tenant middleware.
...that registration page is for users to create a tenant...Yes, that is what I'm trying to do. I think I might have sorted it out but not entirely sure what I changed just yet
Ah, ok. Sorry. I was misunderstanding.
No worries. It still helpful just to have a response 🙂
I'm really not sure what changed directly with this but I did upgrade from 3.2.55 -> 3.2.71 and utilized the new
afterRegister
hook to set a role on the user. It seems like that might have fixed something?Entirely possible. Could have even been a bug in that particular version that was patch in .56
Glad you got it working though.
A lot can happen to 20 patch versions though. Lol.