title: Call to a member function has() on string in laravel
body: <p>I am working on user authentication. When a user provides invalid email or password, I want to redirect him to <code>login.blade.php</code> with a flash error message. </p>
  
  <pre><code>// Auth/LoginController:
  
  public function login(Request $request)
  {
      $user=User::where('email',$request-&gt;email)-&gt;first();
  
      if(!is_null($user))
      {
          if($user-&gt;status==1)
          {
              if(Auth::guard('web')-&gt;attempt(['email'=&gt;$request-&gt;email,'password'=&gt;$request-&gt;password],$request-&gt;remember))
  
                  return redirect()-&gt;intended(route('index'));
  
              }
  
          }
  
          else
          {
  
              if(Auth::guard('web')-&gt;attempt(['email'=&gt;$request-&gt;email,'password'=&gt;$request-&gt;password],$request-&gt;remember))
              {
                  if(Auth::check())
                  {
                      Auth::logout();
                  }
              $user-&gt;notify(new VerifyRegistration($user));
              session()-&gt;flash('success','A new confirmation mail has sent to you...Please check and confirm your email');
              return redirect('/');
              }
              else
              {
                  session()-&gt;flash('errors','Password is incorrect!!');
                  return redirect()-&gt;route('login');
              }
          }
      }
      else
      {
  
          session()-&gt;flash('errors','Email or Password is incorrect!!');
              return redirect('/login');
      }
  }
  </code></pre>
  
  <p>I am using the default laravel <a href="https://snipsave.com/mishudas/#/" rel="nofollow noreferrer"><code>login.blade.php</code></a>.</p>