I have a custom LoginController with two functions:
loginCustomer, which launches Auth :: guard ('customer') -> attempt (...);
loginEmployee, which starts Auth :: guard ('employee') -> try (...);
I configured two guards in config.auth, which points to my two models (Customer and Employee) and protects the backoffice and frontend routes.
Now in my custom LogoutController I want to run Auth :: logout (), but it does not work, because I think it uses the default protection.
It only works if I specify Auth::guard('customer')->logout()or Auth::guard('employee')->logout(), depending on which protector was used to enter.
Is there a way to get the security used to authenticate the user, so I can only use it Auth::guard($guard)->logout?
source
share