F
Filament3mo ago
NolanN

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:
public function panel(Panel $panel): Panel
{
return $panel->id('customer')
->tenant(Customer::class)
->tenantRegistration(RegisterCustomer::class)
...
}
public function panel(Panel $panel): Panel
{
return $panel->id('customer')
->tenant(Customer::class)
->tenantRegistration(RegisterCustomer::class)
...
}
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
awcodes
awcodes3mo ago
Because it’s your tenant. And with tenancy it has to query for it in order to scope the app.
NolanN
NolanN3mo ago
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 also
awcodes
awcodes3mo ago
in that case you would create a different panel that doesn't use tenancy, then you could have a tenant resource on that panel.
NolanN
NolanN3mo ago
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.
awcodes
awcodes3mo ago
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.
NolanN
NolanN3mo ago
...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
awcodes
awcodes3mo ago
Ah, ok. Sorry. I was misunderstanding.
NolanN
NolanN3mo ago
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?
awcodes
awcodes3mo ago
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.
Want results from more Discord servers?
Add your server
More Posts
Loading a table widget on (form) select change.Hi I made a table widget that is displayed under my form. When I change a select, I would like it tHow to test SelectColumn in a table?I am trying to test my SelectColum that when I change a role, that user's role is updated in the datA fully custom laravel page had to be integrated with a filament page. How can this be done?A fully custom laravel page had to be integrated with a filament page. How can this be done?validation.unique is show in FR languageHi, I want to contribute and fix this translation but i don't know how to do I've open a issue forHow can show more chart per line?Hey guys i have a question! How can show more than 2 charts per line, i like show 3 or 4... It's posForceDeleteAction::make() observer?Hi there i want to loop through items that are gonna be force deleted. is there a good method to useIs it necessary to do a check if the file belongs to the user?Users in my app can upload images for different resources. I configured aws s3 to store files of my Open modals, within a Modal with a infolist?I've added a hint action to open a modal and i get this error? ```Currently, infolist actions cannoGenerating slug from title example only working properly when adding debounceI'm using this example code: https://filamentphp.com/docs/3.x/forms/advanced#generating-a-slug-from-Accessing the "admin portal" as different user typesHi all, I wanted to use Filament for 2 different audiences - one is administering the system (users