I want to make user only have 1 login. I already make active column in database with boolean data type.
And then, I use this Auth::user()->active = true; to insert the data to database but it seems didn't work when I try to Login.
This is in my AuthController:
protected function authenticated(){
if (!Auth::user()->active) {
if(Auth::user()->role == 'Admin') {
Auth::user()->active = true;
return redirect('/listUser');
} elseif (Auth::user()->role == 'CCO'){
Auth::user()->active = true;
return redirect('/eCalendar');
}
Auth::user()->active = true;
return redirect('/eCalendars');
} else{
Auth::logout();
return redirect('/login');
}
}
public function logout()
{
Auth::user()->active = false;
Auth::logout();
return redirect('/login');
}
If I try to login, the active column in database won't change. But if logout it success to change to false.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Lv5a2E
via IFTTT
Aucun commentaire:
Enregistrer un commentaire