Get Current Panel id issue

I have two panel at the moment "app", and "jobseekers". I tried to dump the current panel id on one of my resource class inside jobseekers panel but the return string is "app".
Solution:
Add the Closure to the MenuItem then instead ->url(fn () => ...)
Jump to solution
9 Replies
Dennis Koch
Dennis Koch2y ago
Resources are not actual components but shells to reduce code duplication. The code is likely evaluated before Middelwares are run, so it cannot identify the "current panel". You probably need to wrap your logic in a Closure. Best to show some code and explain what you want to do,
dansing
dansingOP2y ago
I guess the main issue is I have these routes listed / registered
dansing
dansingOP2y ago
but when trying to register a profile menu item, I get this error
dansing
dansingOP2y ago
"Route [filament.jobseekers.resources.account.edit] not defined."
Dennis Koch
Dennis Koch2y ago
Same issue: This is a ServiceProvider. It's run before routes are registered. You need to wrap stuff in a Closure:
->userMenuItems(fn () => [...])
->userMenuItems(fn () => [...])
dansing
dansingOP2y ago
based on the userMenuItems of panel it only accepts array
Solution
Dennis Koch
Dennis Koch2y ago
Add the Closure to the MenuItem then instead ->url(fn () => ...)
Dennis Koch
Dennis Koch2y ago
Btw. instead of using route file, use JobSeekersResource::getUrl('edit', 1)
dansing
dansingOP2y ago
Got it, thank you!

Did you find this page helpful?