title: How to login from admin login page and others should login from another login page in laravel 5.8
body: <p>In users table i have admin , editor and blogger i want admin can login from different login page than editor and blogger login page and i have to two login pages and all users exist in users table but blogger or editor shouldn't login from admin login page and same for admin admin should prevent to login in editor and blogger login too and after logged in for admin , editor and blogger for all users redirect me to admin panel , only different login from should have , how can make this please help .</p>
  
  <p>Tip : I have distinguished users by type not role </p>
  
  <p><a href="https://i.stack.imgur.com/P2i5r.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P2i5r.png" alt="users table image"></a> </p>
  
  <p><strong>admin-login.blade.php</strong></p>
  
  <pre><code>
  @include('layouts.app')
  
  
      &lt;div class="sufee-login d-flex align-content-center flex-wrap"&gt;
          &lt;div class="container"&gt;
  
  
  
              &lt;div class="login-content"&gt;
                  &lt;div class="login-logo"&gt;
                      &lt;a href="{{ route('login') }}"&gt;
                          &lt;img class="align-content" src="{{ asset('others') }}/{{  $shareData['admin_logo'] }}" alt=""&gt;
                      &lt;/a&gt;&lt;div style="color: white; text-align: center;"&gt;Admin Login&lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div class="login-form"&gt;
                      &lt;form class="form-horizontal" method="POST" action="{{ route('login') }}"&gt;
                          {{ csrf_field() }} &lt;!-- means you are still using middleware--&gt; &lt;!-- before--&gt;&lt;!-- admin.login.submit --&gt;
                          &lt;div class="form-group"&gt;
                              &lt;label&gt;Email address&lt;/label&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 class="form-group"&gt;
                              &lt;label&gt;Password&lt;/label&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 class="checkbox"&gt;
                              &lt;label&gt;
                                  &lt;input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}&gt; Remember Me
                              &lt;/label&gt;
                              &lt;label class="pull-right"&gt;
                                  &lt;a class="btn btn-link" href="{{ route('password.request') }}"&gt;
                                      Forgot Your Password?
                                  &lt;/a&gt;
                              &lt;/label&gt;
  
                          &lt;/div&gt;
                          &lt;button type="submit" name="login" class="btn btn-success btn-flat m-b-30 m-t-30"&gt;Sign in&lt;/button&gt;
                          &lt;div class="register-link m-t-15 text-center"&gt;
                               &lt;br&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;script src="{{ asset('admin/assets/js/vendor/jquery-2.1.4.min.js') }}"&gt;&lt;/script&gt;
      &lt;script src="{{ asset('admin/assets/js/popper.min.js') }}"&gt;&lt;/script&gt;
      &lt;script src="{{ asset('admin/assets/js/plugins.js') }}"&gt;&lt;/script&gt;
      &lt;script src="{{ asset('admin/assets/js/main.js') }}"&gt;&lt;/script&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  </code></pre>
  
  <p><strong>login.blade.php</strong></p>
  
  <pre><code>
  @include('layouts.app')
  
  
      &lt;div class="sufee-login d-flex align-content-center flex-wrap"&gt;
          &lt;div class="container"&gt;
              &lt;div class="login-content"&gt;
                  &lt;div class="login-logo"&gt;
                      &lt;a href="{{ route('login') }}"&gt;
                          &lt;img class="align-content" src="{{ asset('others') }}/{{  $shareData['admin_logo'] }}" alt=""&gt;
                      &lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div class="login-form"&gt;
                      &lt;form class="form-horizontal" method="POST" action="{{ route('login') }}"&gt;
                          {{ csrf_field() }} &lt;!-- for multiple exception--&gt;
                          &lt;div class="form-group"&gt;
                              &lt;label&gt;Email address&lt;/label&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 class="form-group"&gt;
                              &lt;label&gt;Password&lt;/label&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 class="checkbox"&gt;
                              &lt;label&gt;
                                  &lt;input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}&gt; Remember Me
                              &lt;/label&gt;
                              &lt;label class="pull-right"&gt;
                                  &lt;a class="btn btn-link" href="{{ route('password.request') }}"&gt;
                                      Forgot Your Password?
                                  &lt;/a&gt;
                              &lt;/label&gt;
  
                          &lt;/div&gt;
                          &lt;button type="submit" name="login" class="btn btn-success btn-flat m-b-30 m-t-30"&gt;Sign in&lt;/button&gt;
                          &lt;div class="register-link m-t-15 text-center"&gt;
                              &lt;p&gt;Don't have account ? &lt;a href="{{ route('register') }}"&gt; Sign Up Here&lt;/a&gt;&lt;/p&gt;
                          &lt;/div&gt;
                      &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
  
      &lt;script src="{{ asset('admin/assets/js/vendor/jquery-2.1.4.min.js') }}"&gt;&lt;/script&gt;
      &lt;script src="{{ asset('admin/assets/js/popper.min.js') }}"&gt;&lt;/script&gt;
      &lt;script src="{{ asset('admin/assets/js/plugins.js') }}"&gt;&lt;/script&gt;
      &lt;script src="{{ asset('admin/assets/js/main.js') }}"&gt;&lt;/script&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  
  <p><strong>LoginController.php</strong></p>
  
  <pre><code>&lt;?php
  
  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 = '/back'; // redirect to back page
  
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('guest')-&gt;except('logout');
      }
  }
  
  
  </code></pre>
  
  <p><strong>AdminLoginController.php</strong></p>
  
  <pre><code>
  &lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use Illuminate\Http\Request;
  use App\Http\Controllers\Controller;
  use Auth;
  
  class AdminLoginController extends Controller
  {
  
      public function __construct()
      {
  
          $this-&gt;middleware('guest')-&gt;except('logout'); //who want to have access to this  // before //$this-&gt;middleware('guest:admin');
  
      }
  
  
      public function showLoginForm()
      {
  
  
          return view('auth.admin-login');
  
      }
  
  
      public function login(Request $request)
      {
          // Validate the form data
           $this-&gt;validate($request, [
          'email'   =&gt; 'required|email',
          'password' =&gt; 'required|string|min:6'
        ]);
  
          // Attemp to log the user in
           if (Auth::guard('admin')-&gt;attempt(['email' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password], $request-&gt;remember)) {
          // if successful, then redirect to their intended location
          return redirect()-&gt;intended(route('admins')); // we redirected them where they wanted to go  // admin.dashboard  // route('admins'); should be same with -&gt;name('admins'); in page of web 
        }
  
  
          // If unsuccessful, then redirect back to the login with the form data
          return redirect()-&gt;back()-&gt;withInput($request-&gt;only('email', 'remember'));
      }
  
  
  }
  
  </code></pre>