title: Assigning middleware inside a Middleware handle function in Laravel
body: <p>I want to know If it is possible to assign a middleware or execute a middleware in handle function of another middleware</p>
  <pre><code>&lt;?php
  
  namespace App\Http\Middleware;
  
  use Closure;
  
  class AuthTypeMiddleware
  {
      /**
       * Handle an incoming request.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          if($request-&gt;header('auth_type') === &quot;api&quot;) {
           // execute the auth:api middleware here
          }
          else {
           // execute the auth middleware here
          }
      }
  }
  
  </code></pre>
  <p>I know we can achieve this by creating different route groups with prefix but still I wanted to know if their any possibility of getting this work</p>