Saturday, April 1, 2017

pass a static value to a controller from routes in laravel

i would like to pass a static value(variable or a static string) from route definition to a controller. for example if consider the following route:

Route::get('/', [
      'uses' => '\Controllers\FoController@show',
      'as' => 'show'
]);

i want to pass a variable(ex, $var1) to that, and then can access to that in the FoController constructor or other controller methods , so i don't like that variable's value shows in the url. how can i do this? thanks...



via Sirwan Rauofi

Advertisement