php - Laravel5 passing route args as middleware args -


i route argument passed middleware argument, this

route::get('foo/{id}', ['middleware' => 'bar:{id}', function(){  }); 

how this?

you can request variable:

route::get('foo/{id}', ['middleware' => 'bar', function(){  });  public function handle($request, closure $next) {   $id = $request->id; } 

https://laracasts.com/discuss/channels/general-discussion/how-to-get-url-parameters-at-middleware?page=1

the

bar:id 

is used when want pass string id middleware.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -