Skip to content
Discussion options

You must be logged in to vote

Hey @kczx3 for this particular use-case, something like this might work for you

app()->use(function () {
  $excludedPaths = [
    '/',
    '/excluded-route'
  ];

  $path = request()->getPathInfo();

  if (in_array($path, $excludedPaths))  {
    return;
  }

...
});

This way the middleware will run before all your routes, but you can still skip the ones it's not needed on

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mychidarko
Comment options

Answer selected by kczx3
@kczx3
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants