title: Prevent login if user isnt approved laravel 5.4
body: <p>I checked all around for information about how to check on login  if user is approved or not and then redirect to logged in or give an error. Now i am little confused because in internet there are a lots of posts and every one is different. So can anyone can help me to deal with this? Also it would be really nice to explain how it works (sintaxes and all other stuff)</p>
  
  <p>User.php:</p>
  
  <pre><code>    namespace App;
  
      use Illuminate\Notifications\Notifiable;
      use Illuminate\Foundation\Auth\User as Authenticatable;
  
      class User extends Authenticatable
      {
          use Notifiable;
  
      /**
       * The attributes that are mass assignable.
       *
       * @var array
       */
       protected $fillable = [
      'companyname', 'email', 'password', 'VAT', 'companyphone', 
      'companystreet', 'companycity', 'companycountry', 'companypostcode'
      ];
  
      /**
      * The attributes that should be hidden for arrays.
      *
   * @var array
   */
  protected $hidden = [
      'password', 'remember_token',
  ];
  </code></pre>
  
  <p>}</p>
  
  <p>LoginController :</p>
  
  <pre><code>    namespace App\Http\Controllers\Auth;
  
      use App\Http\Controllers\Controller;
      use Illuminate\Foundation\Auth\AuthenticatesUsers;
  
      class LoginController extends Controller
      {
  /*
  |--------------------------------------------------------------------------
  | Login Controller
  |--------------------------------------------------------------------------
  |
  | This controller handles authenticating users for the application and
  | redirecting them to your home screen. The controller uses a trait
  | to conveniently provide its functionality to your applications.
  |
  */
  
  use AuthenticatesUsers;
  
  /**
   * Where to redirect users after login.
   *
   * @var string
   */
  protected $redirectTo = '/';
  
  /**
   * Create a new controller instance.
   *
   * @return void
   */
  public function __construct()
  {
      $this-&gt;middleware('guest')-&gt;except('logout');
  }
  
  
      }
  </code></pre>
  
  <p>login.blade.php : </p>
  
  <pre><code>    @extends('layouts.app')
  
      @section('content')
        &lt;div class="container"&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-md-8 col-md-offset-2"&gt;
          &lt;div class="panel panel-default"&gt;
              &lt;div class="panel-heading"&gt;Login&lt;/div&gt;
  
              &lt;div class="panel-body"&gt;
                  @if($status = Session::get('status'))
                      &lt;div class ="alert alert-info"&gt;
                          {{$status}}
                      &lt;/div&gt;
                  @endif
                  &lt;form class="form-horizontal" method="POST" action="{{ route('login') }}"&gt;
                      {{ csrf_field() }}
  
                      &lt;div class="form-group{{ $errors-&gt;has('email') ? ' has-error' : '' }}"&gt;
                          &lt;label for="email" class="col-md-4 control-label"&gt;E-Mail Address&lt;/label&gt;
  
                          &lt;div class="col-md-6"&gt;
                              &lt;input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus&gt;
  
                              @if ($errors-&gt;has('email'))
                                  &lt;span class="help-block"&gt;
                                      &lt;strong&gt;{{ $errors-&gt;first('email') }}&lt;/strong&gt;
                                  &lt;/span&gt;
                              @endif
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group{{ $errors-&gt;has('password') ? ' has-error' : '' }}"&gt;
                          &lt;label for="password" class="col-md-4 control-label"&gt;Password&lt;/label&gt;
  
                          &lt;div class="col-md-6"&gt;
                              &lt;input id="password" type="password" class="form-control" name="password" required&gt;
  
                              @if ($errors-&gt;has('password'))
                                  &lt;span class="help-block"&gt;
                                      &lt;strong&gt;{{ $errors-&gt;first('password') }}&lt;/strong&gt;
                                  &lt;/span&gt;
                              @endif
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;div class="col-md-6 col-md-offset-4"&gt;
                              &lt;div class="checkbox"&gt;
                                  &lt;label&gt;
                                      &lt;input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}&gt; Remember Me
                                  &lt;/label&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
  
                      &lt;div class="form-group"&gt;
                          &lt;div class="col-md-8 col-md-offset-4"&gt;
                              &lt;button type="submit" class="btn btn-primary"&gt;
                                  Login
                              &lt;/button&gt;
  
                              &lt;a class="btn btn-link" href="{{ route('password.request') }}"&gt;
                                  Forgot Your Password?
                              &lt;/a&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
  @endsection</p>
  
  <p>Also in my DB is boolean field "activated" default 0</p>