You need to make a url with an indefinite number of parameters, 2 of which are arrays. I want to do a search.

For example:

kino.com/{category?}/{country?}/{actors?}/{eactors?} 

And it will look something like this:

 kino.com/komedii/kanada/actors/45/154/eactors/67/99 kino.com/uzhasyi kino.com/rossiya/eactors/56/87/34 
  1. category - category
  2. country - country
  3. actors - actors (who should be in the film), or rather their id
  4. eactors - the actors (who should not be in the film), or rather their id

actors and eactors arrays.

This is easy to do in PHP via get (kino.com?category=komedii&country=kanada, etc.), but how to do it with Laravel and CNC?

    2 answers 2

    Send the parameters via get, you don’t make a random number of parameters through the CNC. To transmit via get just do not specify the parameters when initializing the route

    • Parameters of all four, just some may not be. The main problem in actors and eactors, it is not clear how to implement. Made it Route::get('/films/{category?}/{country?}/{actors ?}/{eactors?}', 'RecipeController@index') ->where(['actors' => '^actors/[0-9\/]+$', 'eactors' => '^eactors/[0-9\/]+$']); But if the url will be like this: test.com/films/france/eactors/2/79/205 will return 404, and this is normal: test.com/films/komedii/kanada/actors/45/147/180/eactors/2/79/205 - Billy Milligan
    • The optional parameter (which is with?) in routs is usually used at the end of the link, and not in the middle. If there is no parameter, then the dividing slash still remains. Those. if you output this url then get test.com/films/france//eactors/2/79/205 - apelsinka223

    https://laracasts.com/series/laravel-5-fundamentals

    Base about routes (routing) - 3 lesson. Translation there is in principle not needed, tk. the code is clear. Also routes are affected in 9, 13 and 18 lessons. The answer to your question seems at 9m.

    I recommend to see all the lessons, 99% of the usual tasks you then easily decide (well, or you will remember where to see them)

    • The fact is that this is all I know. In these lessons, even close to the answer. - Billy Milligan