I have an admin table and a users table, the admin approves or dismisses the user, a user registers the application is sent to the admin who have two buttons, one for accepting and the other for rejecting the user, when activated the activated column is set to 2, if deactivated its set to 0, initially its 1, now my query is about loging in the users,,,
how do I do it?
here are my login controller
if(auth()->attempt(['adm_no'=>$request->input('adm_no'),'password'=>$request->input('password')])){
$user=User::where('adm_no',$request->adm_no)->first();
if($user->activated()){// if activated column is 2 redirects
return redirect('students.dashboard');
}else{
return redirect()->back(); // if activated value is 0 i.e if its deactivated
}
}else{
return redirect('auth.userlogin')->withInput(); // if activated value is 1 by default
}
}
this method checks if activated is 2 i.e if its activated
public function activated()
{
if ($this->activated==2) {
return true;
}else{
return false;
}
}
my question is, is this the right way to redirect user,,, or is there a better way,,,, am a newbie to laravel,,, kindly bear with me...
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qWVnM6
via IFTTT
Aucun commentaire:
Enregistrer un commentaire