F
Filament4mo ago
Eskie

FilamentFilament::getCurrentPanel() outside panel issue

I was expecting that Filament::getCurrentPanel() will return null if I am accessing it outside the panel like a public facing page but instead it returns the value of my panel...
4 Replies
awcodes
awcodes4mo ago
Iirc, current panel returns the default panel if no panel currently set. I believe that behavior has changed in v4 though. What are you trying to do, there may be another way to accomplish it.
Eskie
EskieOP4mo ago
Thanks! I have this local scope and I dont want to apply it in the public facing pages.. so what I did was to use this request()->routeIs('filament.*') that is my work around..
Dennis Koch
Dennis Koch4mo ago
You can use Filament::serving(fn () => ) callback to run only on Filament pages.
Eskie
EskieOP4mo ago
cool! i didn't know this

Did you find this page helpful?