My front sends parameters in the url and I would like to get them back to my laravel controller.
My route (back)
Route::get('publication/Mls/{status}/{typeTransac}', 'MlsController@getIndicatorMlsList');
The console shows me this on the front side
api/user/publication/Mls?status=Archive&typeTransac=Vente
How do I get this information back?
they are not the same route. you have to change either in front end or back end. the front end url is
api/user/publication/Mls?status=Archive&typeTransac=Vente
in this url api/user/publication/Mls
is the base url and ?status=Archive&typeTransac=Vente
is request parameter. to get it in the laravel side you need a route like
Route::get('publication/Mls', 'MlsController@getIndicatorMlsList');
assuming you have user
prefixed in your route. if not you have to add that too in your route.
now in your controller you can access the request parameter
public function getIndicatorMlsList (Request $request)
{
$status = $request->status;
$typeTransac = $request->typeTransac;
}
or you can keep your back end route as same as it is now and change the front end url
api/user/publication/Mls/Archive/Vente
and in the controller
public function getIndicatorMlsList ($status, $typeTransac)
{
//the function parameters are the values from the url
}