You just take user status and check user status is true or false. You can take status using Auth::User()->status from auth session. Try this.
public function login(Request $request)
{
$request->validate([
'email' => 'required',
'password' => 'required',
]);
if(Auth::attempt(['email'=>$request->email,'password'=>$request->password])){
$userStatus = Auth::User()->status;
if($userStatus=='1') {
return redirect()->intended(url('dashboard'));
}else{
Auth::logout();
Session::flush();
return redirect(url('login'))->withInput()->with('success','You are temporary blocked. please contact to admin');
}
}
else {
return redirect(url('login'))->withInput()->with('success','Incorrect username or password. Please try again.');
}
}
Discover more from Soa Technology | Aditya Website Development Designing Company
Subscribe to get the latest posts sent to your email.