php - Lumen: how can I get url parameters from middleware -


this routes.php:

$app->get('/users/{id}/', ['middleware' => 'example', function () {   return "users"; }]); 

this handle function in middleware:

public function handle($request, closure $next) {   // value of url parameter {id} here    return $next($request); } 

is there way can parameter id middleware?

* edit *

i'm using lumen 5.1.0.

there conventional ways in laravel doesn't work on lumen. , parameter form uri in middleware 1 of them. in laravel, need call $request->id, work magic. here in order parameter in lumen, need this:

$request->route()[2]['id'] 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -