title: How do I manually authenticate user in Laravel 5.4
body: <p>I am trying to authenticate user in laravel 5.4, using attempt() I am able to authenticate user, but my I want to also check for if user is active or not and also show the custom message depending upon if user is inactive then different message and if username password is different then different message.</p>
  
  <p>My authentication code :</p>
  
  <pre><code>public function checklogin(Request $request)
      {
          $password = bcrypt($request-&gt;password);
          $userData = User::where('email',$request-&gt;email)-&gt;where('password',$password)-&gt;first();
          if($userData!=NULL)
          {
              $credentials=array('email' =&gt; $request-&gt;input('email'),'password' =&gt; $request-&gt;input('password'),'status' =&gt; 'active');
  
              if(Auth::guard('users')-&gt;attempt($credentials)) 
                  return redirect()-&gt;intended('/dashboard');
               else
               {
                  Mail::to($request-&gt;email)-&gt;send(new VerifyUser($userData));
                  return redirect('/')-&gt;with('error','Your account is unverified - check your email for account verification link');
               }
          }
          else
              return redirect('/')-&gt;with('error','Invalid username or password');
  
  
      }
  </code></pre>
  
  <p>Here, I first want to check if login credentials are correct or not, If they are invalid then it will directly show error message "invalid username or password", if suppose login credentails are correct, then I am trying to attempt login , if user is inactive then I want to show the message that "you need to verify your account" , if user is active then it will redirect user to dashboard.</p>
  
  <p>But in my case I am not able to authenticate user even if I bcrypt the password and cross check it with the password in db table.</p>