Missing tenant parameter on routes
Hi, I'm trying to setup a profile page that lives within the application layout. In order to do this, I'm extending the EditProfile class, and trying to set the layout as the index, instead of the simple one. However, as soon as I try to do this, I get the error: Missing required parameter for [Route: filament.admin.pages.dashboard] [URI: admin/{tenant}] [Missing parameter: tenant].
Any ideas? I had the same issue when trying to setup the Spotlight package.
20 Replies
Can you share your custom EditProfile class?
commented out stuff breaks the routing:
Not sure I understand, do you need this page to be scoped to a tenant?
I don't. I just need to render the profile page within the entire app's layout, not in a different (simple) layout. So have the sidebar, the nav, etc.
āļø That would work if tenancy wasn't in the app
I had the exact same issue when setting up the Spotlight plugin. The way I'm using tenancy is maybe a bit different, my dashboard has several "projects". I use tenancy to keep track of the "active project".
Hmm ok. I still don't really understand why the default EditProfile doesn't work in your case.
default does work. It's when I add this line that it doesn't:
Ok sorry, I missed this part
I just need to render the profile page within the entire app's layout
Ofc no worries š
So if I'm following correctly, using the regular layout with the EditProfile page is giving you this error about the Dashboard?
So, the default EditProfile class renders this view (taken from the vendor): . The view uses the page.simple panel layout. That's why it renders without the application layout (sidebar, etc). With that line that breaks the app: what I'm doing is basically changing the layout to use the application layout (including the sidebar, etc). But that's the issue, I can't extend that layout :/
and the error that's outputted is the following: .
I've tried playing around with the routes, so there's a routes method in the EditProfile class: but tried a few things and couldn't get it to work :/
dd($tenant)
is probably returning null here, right?yeah that's right!
Do you think you can make a custom page instead of using the default EditProfile? It shouldn't be too complicated to re-create it as a regular page with the regular layout?
yeah sure thing, that could work indeed. However I'm still unsure as to why it's happening, do you have any ideas?
So the profile page exists outside of tenancy (ie.
/admin/profile
), and that works fine using the Simple layout. But when you switch to the regular layout, and the rest of your Panel is using tenancy, it needs to know the current tenant to generate all the links in the sidebar (for example the Dashboard at /admin/4
).
It fails because it doesn't know it should put 4
when it's generating the URL to the dashboard, because the profile has no reference to the tenant.
Try this in your EditProfile, you'll see what I mean:
Ah that makes sense I guess! Thanks for the clarification. Do you know if it's some kinda know issue, or an issue at all? Would be nice to have a property to bypass/overwrite that š
Well I think the short answer is that the Profile page is not designed to use the
index
layout, heheYeah got that haha. I did have the same issue trying to setup the Spotlight plugin tho!
It's possible that there's a simple solution... I can't quite think of it. But this hack with
setTenant()
should work. You just need to figure out how to store the current tenant in the session. If that makes sense.Right, makes sense. Thanks for the help!