How to disable filament sidebar for guest user

I need to disable sidebar sidebar for guest user , so i made this command :

->sidebarWidth(auth()->check() ? '20rem' : '0rem')

but it semms auth()->check() always will be false in the PanelProvied files because it's loading before session making
so how can i handle it without editing the base file?
Solution
I could solve it
i added the my code to custom middleware as :

filament()->getCurrentPanel()->sidebarWidth(auth()->check() ? '20rem' : '0rem');
Was this page helpful?