samedi 25 avril 2020

Laravel dynamic routing for search

I would like to generate dynamic route when user clicks on Search button.

I know it can be done with following GET method

https://laravel.dev/search?q=parameter 
https://laravel.dev/search?state=XYZ&category=Automobile

But instead I would like to do following

https://laravel.dev/search/state/XYZ/category/Automobile

So if I add an extra parameter in search form it will just add onto the URL.

The parameters may be optional so can not add a fix route in routes. User may supply state or search through all states.

https://laravel.dev/search/category/Automobile

How can I achieve that?

Thank you



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3bFvWU2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire