Lumen - Middleware running on all requests

Asked

Viewed 41 times

1

I created a Middleware which is working perfectly, but it is running on routes that I have declared in the route group and is also running on other routes that I have not declared.

Example:


Route 1:

$router->post('/xpto', 'Controller@xpto');

Route 2:

$router->group(['middleware' => 'meuMiddleware'], function () use ($router) {
   $router->post('/xpto2', 'Controller@xpto2');
});

Both routes of the example are calling the Middleware.

  • Where is the first route set? How did you prove that the middleware is running on it?

  • Put your App Kernel.php here. If you have placed the class of this Middleware in the array $middleware, it will run on all routes.

  • Perfect, I changed the Middleware record and it worked. Thank you

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.