F
Filament16mo ago
dansing

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 Koch16mo 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
dansingOP16mo ago
I guess the main issue is I have these routes listed / registered
dansing
dansingOP16mo ago
but when trying to register a profile menu item, I get this error
dansing
dansingOP16mo ago
"Route [filament.jobseekers.resources.account.edit] not defined."
Dennis Koch
Dennis Koch16mo 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
dansingOP16mo ago
based on the userMenuItems of panel it only accepts array
Solution
Dennis Koch
Dennis Koch16mo ago
Add the Closure to the MenuItem then instead ->url(fn () => ...)
Dennis Koch
Dennis Koch16mo ago
Btw. instead of using route file, use JobSeekersResource::getUrl('edit', 1)
dansing
dansingOP16mo ago
Got it, thank you!
Want results from more Discord servers?
Add your server