title: Laravel redirect to specific route when user is not logged
body: <p>If i go to <a href="http://www.yourdomain.com/admin/login" rel="nofollow noreferrer">http://www.yourdomain.com/admin/login</a> i see my login page.</p>
  
  <p>If i go to <a href="http://www.yourdomain.com/admin/example" rel="nofollow noreferrer">http://www.yourdomain.com/admin/example</a> i have the redirect to <a href="http://www.yourdomain.com/login" rel="nofollow noreferrer">http://www.yourdomain.com/login</a> without the admin.</p>
  
  <p>My web routes:</p>
  
  <pre><code>Auth::routes();
  
  Route::prefix('admin')-&gt;group(function() {
      Route::get('/login','Auth\AdminLoginController@showLoginForm')-&gt;name('admin.login');
      Route::post('/login','Auth\AdminLoginController@login')-&gt;name('admin.login.submit');
      Route::get('/manifiesto','AdminController@getIndex')-&gt;name('admin.dashboard');
      Route::get('/logout','Auth\AdminLoginController@logout')-&gt;name('admin.logout');
      Route::get('/trabajadores','AdminController@showTrabajadores')-&gt;name('admin.trabajadores');
      Route::get('/clientes','AdminController@showClientes')-&gt;name('admin.clientes');
      Route::get('/proyectos','AdminController@showProyectos')-&gt;name('admin.proyectos');
      Route::get('/administradores','AdminController@showAdmins')-&gt;name('admin.administradores');
  });
  </code></pre>
  
  <p>When i put some url with the /admin before and user isn't logged, i want to redirect to /admin/login.</p>
  
  <p>Thanks.</p>
  
  <p>More info:</p>
  
  <p>App/http/Controllers/Auth/AdminLoginController.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use App\Http\Controllers\Controller;
  use Illuminate\Foundation\Auth\AuthenticatesUsers;
  use Auth;
  class AdminLoginController extends Controller
  {
  
      protected $loginPath = 'admin/login';
  
      public function __construct()
      {
          $this-&gt;middleware('guest:admin', ['except' =&gt; ['logout']]);
      } 
      public function showLoginForm()
      {
          return view('backend.public.pages.login');
      }
      public function login(Request $request)
     {
         //validate the form data
         $this-&gt;validate($request, [
             'email' =&gt; 'required|email',
             'password' =&gt; 'required|min:6'
         ]);
         //attempt 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('admin.dashboard'));
         }
         return redirect()-&gt;back()-&gt;withInput($request-&gt;only('email','remember'));
     } 
  
     public function logout()
     {
         Auth::guard('admin')-&gt;logout();
  
         return redirect('/');
     }
  }
  </code></pre>
  
  <p>App\Http\Middleware\AdminAuthenticate.php</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  use Illuminate\Support\Facades\Auth;
  
  class AdminAuthenticate
  {
  /**
   * Handle an incoming request.
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  \Closure  $next
   * @param  string|null  $guard
   * @return mixed
   */
   public function handle($request, Closure $next)
   {
      if ($this-&gt;auth-&gt;guest())
      {
          if ($request-&gt;ajax())
          {
              return response('Unauthorized.', 401);
          }
          else
          {
              return redirect()-&gt;guest('admin/login'); // &lt;--- here
          }
      }
  
      return $next($request);
   }
  }
  </code></pre>