Middleware paramaters
Ad
From the docs I can see that to pass a parameter editor
to a middleware role
you write
Route::put('post/{id}', ['middleware' => 'role:editor', function ($id) {
...
}]);
And to use the parameter in the middleware, you simply pass the parameter into the handle function
public function handle($request, Closure $next, $role)
{
...
}
My question is, where is this editor
parameter coming from? I can only see the id
in the URL string being passed about.
Ad
Answer
Ad
The $role
variable within the handle parameters will contain the variable passed in after role:
so role:editor
will return "editor"
Ad
source: stackoverflow.com
Related Questions
Ad
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS - Conditionally Load a Different Page
- → Make a Laravel collection into angular array (octobercms)
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
- → Validating fileupload(image Dimensions) in Backend Octobercms
- → OctoberCMS Fileupload completely destroys my backend
- → How do I call the value from another backed page form and use it on a component in OctoberCms
Ad