jeudi 27 avril 2017

Laravel middleware get route post data and custom route key-value pairs

I have a route that i am using to post data to server. I want to get the posted data and log that in the db. Can i get the form post data in the handle function

public function handle($request, Closure $next) {
      echo "...intercept post data";
      return $next($request);
   }

Second, i have this route for instance,

Route::get('role',[
   'middleware' => 'Role:editor',
   'uses' => 'TestController@index',
]);

I want to add a custom key value that i can access from the middleware, i.e

Route::get('role',[
   'middleware' => 'Role:editor',
   'uses' => 'TestController@index',
   'deed' => 'Viewed registered users'
]);

In the above route i added the key deed.Is this possible in laravel 5 and
can i access it in a middleware?.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2qhs5UZ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire