getCurrentPanel returning wrong panel
I’ve two panels -
company
and seeker
. Both appear to be working correctly until I call Filament::getCurrentPanel()->getId()
in a middleware I am using to apply global scopes. It always returns company
. My goal is to apply different global scopes based on the active panel to limit access to certain records.
Solution:Jump to solution
Fixed it. I was applying my middleware in the Laravel kernel file, not the middleware section of the panel’s config.
So it looks like the default panel is loaded by Laravel then replaced later.
```php...
1 Reply
Solution
Fixed it. I was applying my middleware in the Laravel kernel file, not the middleware section of the panel’s config.
So it looks like the default panel is loaded by Laravel then replaced later.
Panel middleware means I don’t even need to do the check in my middleware code, that’s already done!