Filament auth guard logout

I'm using two different guards for users (web) and admins (admin). For users, I can destroy the web guard session when logout. Since I use filament for admin panel, its custom logout destroys both web and admin guard sessions. How do I make it so that when admin logout it only destroy the admin guard.
6 Replies
shadowburnz
shadowburnzOP7d ago
Can anyone help me? Please 🙏
krekas
krekas7d ago
Ditch guards and use roles instead...
shadowburnz
shadowburnzOP7d ago
Yes, I use ->authGuard('admin'). It works for login but logout destroy both web and admin sessions
Bruno Pereira
Bruno Pereira7d ago
according the controller it invalidates all the session
class LogoutController
{
public function __invoke(): LogoutResponse
{
Filament::auth()->logout();

session()->invalidate();
session()->regenerateToken();

return app(LogoutResponse::class);
}
}
class LogoutController
{
public function __invoke(): LogoutResponse
{
Filament::auth()->logout();

session()->invalidate();
session()->regenerateToken();

return app(LogoutResponse::class);
}
}
So my best bet is to create your own logout controller and modify to your needs
shadowburnz
shadowburnzOP7d ago
This could work. I will try it. Thank you for your response.

Did you find this page helpful?