Url friendly on requests get laravel

-1

How can I make the urls that result from get requests and receive friendly parameters, that is, I have this request:

    Route::get('buscarParticipante','CarreraController@buscarParticipante')->name('buscar.participante');

And I send the parameters and they come out in the following way in the uri:

buscarParticipante?search=1&carrera=1&participante=1

What I would like to do is make this url friendly because I need to share it, but I would like something like this:

buscarParticipante/search/1/carrera/1/participante/1
    
asked by Susje 16.07.2018 в 02:03
source

1 answer

0
 Route::get('buscarParticipante/{var1}/delete/{var2}','CarreraController@buscarParticipante')->name('buscar.participante');

Then in the controller you can rescue them using $ request or define a function that receives the same number of parameters defined in the url

public function buscarParticipante($var1, $var2){
    dump($var1);
    dump($var2);
    dd();
}

the order of parameters that the function receives will be the same as the one in which they were defined in the route, on the contrary you can obtain them by the Request

public function buscarParticipante(Request $request){
    dd($request->all());
}

If you are looking for more friendly publications or similar names, I recommend this library: eloquent-sluggable you can search it on github

    
answered by 16.07.2018 в 04:08