There's a way to pass parameters to a route middleware?

This is my route middlewares:

Route.resource('/users', 'Autenticacao/UserController')
  .only(['index', 'store', 'update'])
  .middleware(['auth', 'permissions']);

I’m looking if there’s a way to do something like:

Route.resource('/users', 'Autenticacao/UserController')
  .only(['index', 'store', 'update'])
  .middleware(['auth', 'permissions:"An String there i need to pass in parameter"']);

If i try this way i receive:

SyntaxError: Unexpected token ‘:’

And in my middleware get this parameter.
This is possible?

1 Like

Oh sorry, i can make this work with:

.middleware(['auth', 'permissions:My string']);

and in my middleware add a new parameter

2 Likes