title: Auth is not working in middleware in Laravel
body: <p>I have successfully loggedin my adminpanel but while I redirect to dashboard after login using middleware it's not working.</p>
  
  <p><strong>login controller</strong></p>
  
  <pre><code>if (Auth::attempt(['username' =&gt; $request-&gt;email, 'password' =&gt; $request-&gt;password]))
  {
      return redirect('/dashboard');
  }
  </code></pre>
  
  <p><strong>route</strong></p>
  
  <pre><code>Route::group(['middleware' =&gt; ['adminAuth']], function () {
  
      Route::get('/dashboard', 'dashboardController@index');
  
  });
  </code></pre>
  
  <p><strong>dashboard controller</strong></p>
  
  <pre><code>public function index()
  {
      return 'admin dashboard';
  }
  </code></pre>
  
  <p><strong>adminAuthenticate.php Middleware</strong></p>
  
  <pre><code> public function handle($request, Closure $next)
  {
      if(Auth::check() &amp;&amp; Auth::user()-&gt;role_code == '1'){
          return $next($request);                
      }    
      return abort(404);
  }
  </code></pre>
  
  <p><strong>kernel.php</strong></p>
  
  <pre><code>protected $routeMiddleware = [
          'auth' =&gt; \App\Http\Middleware\Authenticate::class,
          'auth.basic' =&gt; \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
          'bindings' =&gt; \Illuminate\Routing\Middleware\SubstituteBindings::class,
          'cache.headers' =&gt; \Illuminate\Http\Middleware\SetCacheHeaders::class,
          'can' =&gt; \Illuminate\Auth\Middleware\Authorize::class,
          'guest' =&gt; \App\Http\Middleware\RedirectIfAuthenticated::class,
          'password.confirm' =&gt; \Illuminate\Auth\Middleware\RequirePassword::class,
          'signed' =&gt; \Illuminate\Routing\Middleware\ValidateSignature::class,
          'throttle' =&gt; \Illuminate\Routing\Middleware\ThrottleRequests::class,
          'verified' =&gt; \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
          'adminAuth' =&gt; \App\Http\Middleware\adminAuthenticate::class,
      ];
  </code></pre>
  
  <p>Always it returns '404' page though I have successfully loggedin.</p>
  
  <p>Where is the problem ? anybody help please ? Thanks in advance</p>