Add logout navigationItem to sidebar

Hello ! I'm trying to add a navigation item on my sidebar to logout, I made this in my panel :
->navigationItems([
NavigationItem::make('Déconnexion')
->url('/logout')
->icon('heroicon-o-arrow-left-start-on-rectangle')
->sort(12)
])
->navigationItems([
NavigationItem::make('Déconnexion')
->url('/logout')
->icon('heroicon-o-arrow-left-start-on-rectangle')
->sort(12)
])
but it's not the right method for logout and I can't link the Logout action because NavigationItem doesn't have something to do this
2 Replies
toeknee
toeknee5d ago
I suspect that's because you would need something like: NavigationItem::make('log_me_out')->url(\Filament\Facades\Filament::getPanel()->getLogoutUrl() But even then I think the logout method requires a post request, I'd probably suggest adding your own logout controller?
Nashoba
NashobaOP5d ago
Thank you !

Did you find this page helpful?