Tenant Settings page under provider
I'm unaware if this is a coding issue on my end or a bug.
I've created a custom page called Settings which have the name filament.app.pages.settings.
When I dump this in a test route outside Filament I get this
"http://localhost/app/dwa/settings" // routes/web.php:29
When I try this:
under my provider it says the route name does not exist?Solution:Jump to solution
@anitexs You have to do a closure inside it for it to work. The docs are wrong on this so I guess open an issue or I can.
But do this instead.
For a page inside a panel that DOESN'T have tenancy you can do one of these:...
34 Replies
Run php artisan route:list to see what the route is named
That's where I got the name from 🙂
What if you did ->url(SettingsPage::getUrl()). Might not be the correct text but it’s typically better to call the url off the class than to use the route helper in a filament context.
Still the same
And I am reffering to the correct settings page
Do you mind sharing the Settings class you are using.
Maybe even a dumb question but is this you’re only panel and if so does it have ->default() on it?
Might even need getUrl(panel: ‘panel-id’)
Default should take care of that though.
I have the admin panel which is not a tenant based. Then I have the App Panel which is Tenant based. I have two tenants in my test enviroment right now.
Two panels you mean?
Yes.
At least one of them needs default() otherwise it will break things.
I've placed the default on the App now
Still same issue
Try passing the panel to the getUrl function.
Still the same issue
Sorry not sure then. Source diving the code looks like that should work.
That what I thought too
Could be a bug. Just not sure. I don’t have a lot of need for tenancy so I’m not overly experienced with it in v3.
When I go to my custom route called /test
It pastes the correct path
It's like the route name is not yet loaded
If I have time tomorrow I can play around with it some. Hope someone else can help out though.
If you get it to work, please let me know 🙂
Will definitely do. I want to understand the tenancy stuff more. Just hard to do without a practical need. But will let you know for sure.
You found something? 🙂
I notice that it's
Settings::class
and not Pages\Settings:class
, is it in the correct location and namespace?Solution
@anitexs You have to do a closure inside it for it to work. The docs are wrong on this so I guess open an issue or I can.
But do this instead.
For a page inside a panel that DOESN'T have tenancy you can do one of these:
For a page inside a panel that DOES have tenancy you do this:
You can also pass in the tenant parameter inside the
getUrl()
method but it isn't required and should work either way.
I would guess the issue arises because url(Page::getUrl())
expression is evaluated immediately when not inside a closure. If the route associated with Page::getUrl()
hasn't been defined at that point, the error occurs.I tried all of them haha, but yes Settings::class was correct since I included it in the use at the top.
If you could do it that would be wonderful 🙂
Did what I showed you work?
I've not tested, I will do in a sec 🙂
It works 😄 Thanks 🙂
This one:
Good. Your welcome