title: Laravel middleware - return response with errors
body: <p>I want to create a very simple passphrase entry middleware for staging sites, but I need access to the error bag (from the web middleware) but cant seem figure it out:</p>
  
  <pre><code>&lt;?php namespace App\Http\Middleware;
  
  use Closure;
  use Illuminate\Http\Request;
  
  class AccessProtection 
  {
  
      /**
       * [handle description]
       * @param  [type]  $request [description]
       * @param  Closure $next    [description]
       * @return [type]           [description]
       */
      public function handle( $request, Closure $next )
      {
          if( ! app()-&gt;environment( 'production' ) ) {
  
              /** Checks for a submission for access to the site */
              if( ! is_null( $response = $this-&gt;checkForAccessRequest( $request ) ) ) return $response; 
              /** Checks to see if access has already been granted */
              if( ! is_null( $response = $this-&gt;checkForAccessPermission() ) ) return $response; 
  
          }
          return $next( $request );
      }
  
      /**
       * [checkForAccessPermission description]
       * @return [type] [description]
       */
      protected function checkForAccessPermission()
      {
          if( ! session()-&gt;has( 'access_permission' ) ) {
              return response()-&gt;make( view( 'global.permission' , [ 'error' =&gt; false ]), 401 );
          }
      }
  
      /**
       * [checkForAccessRequest description]
       * @param  [type] $request [description]
       * @return [type]          [description]
       */
      protected function checkForAccessRequest( $request )
      {
          if( $passphrase = $request-&gt;input( 'passphrase' ) ) {
              if( strcmp( $passphrase, env( 'PASSPHRASE', 'purpose' ) ) !== 0 ) {
                  return response()-&gt;make( view( 'global.permission' , [ 'error' =&gt; 'Sorry passphrase was incorrect' ]), 401 );
              }
              $request-&gt;session()-&gt;put( 'access_permission', true );
          }
      }
  
  }
  </code></pre>
  
  <p>any help much appreciated.</p>