I need to make a url with undetermined number of parameters. So I want to make search.
For example:
test.com/recipes/{category?}/{country?}/{ingredients?}/{eingredients?}
test.com/breakfast/france/ingredients/45/147/180/eingredients/2/79/205
test.com/france/eingredients/2/79/205
test.com/breakfast/ingredients/45/147/180
test.com/breakfast
ingredients and eingredients are arrays.
ingredients - included in the recipe (ids) eingredients - excluded from the recipe (ids)
I have an idea:
Route::get('/recipes/{category?}/{country?}/{ingredients?}/{eingredients?}', 'RecipeController@index')
->where(['ingredients' => '^ingredients/[0-9\/]+$', 'eingredients' => '^eingredients/[0-9\/]+$']);
but it does not work:
test.com/france/eingredients/2/79/205
I get page 404...
How i can make it?
P.S: I just started learning laravel.