php - Login users only if they meet the condition - Laravel
Solution:
It's clear if you read section Manually Authenticating Users of the official documentation:
If you wish, you may also add extra conditions to the authentication query in addition to the user's e-mail and password. For example, we may verify that user is marked as "active":
if (Auth::attempt(['email' => $email, 'password' => $password, 'active' => 1])) > { // The user is active, not suspended, and exists. }
Answer
Solution:
I would advise using laravel's built in authentication for a login form. You can read about it here: https://laravel.com/docs/5.1/authentication
Answer
Solution:
You can do like this
if(auth()->user->status == 0){
return redirect()->route('login');
}
Source