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 category or may not.

How can I achieve that?

Thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire