title: Laravel check if route is api or web
body: <p>How can I check wether the middleware is web or auth.
  Following Returns all routes, but I want to divide between api and web.</p>
  
  <pre><code>$routes = app()-&gt;routes-&gt;getRoutes();
  foreach($routes as $routeKey =&gt; $routeValue)
  {
      dd($routeValue);
  }
  </code></pre>
  
  <p>returns this:</p>
  
  <pre><code>Route {#109 ▼
    +uri: "oauth/authorize"
    +methods: array:2 [▶]
    +action: array:6 [▼
      "middleware" =&gt; array:2 [▼
        0 =&gt; "web"
        1 =&gt; "auth"
      ]
      "uses" =&gt; "\Laravel\Passport\Http\Controllers\AuthorizationController@authorize"
      "controller" =&gt; "\Laravel\Passport\Http\Controllers\AuthorizationController@authorize"
      "namespace" =&gt; "\Laravel\Passport\Http\Controllers"
      "prefix" =&gt; "oauth"
      "where" =&gt; []
    ]
    +controller: null
    +defaults: []
    +wheres: []
    +parameters: null
    +parameterNames: null
    +computedMiddleware: null
    +compiled: CompiledRoute {#203 ▶}
    #router: Router {#21 ▶}
    #container: Application {#3 ▶}
  }
  </code></pre>