B
B
Billy Milligan2015-11-22 17:23:22
Laravel
Billy Milligan, 2015-11-22 17:23:22

How to make url with parameters in Laravel 5?

You need to make a url with an indefinite number of parameters, 2 of which are arrays. I want to search like this.
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

category - category
country - country
actors - actors (which should be in the movie), or rather their id
eactors - actors (which should not be in the movie), 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?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
IceJOKER, 2015-11-22
@Billy_Milligan

You yourself answered your own question.
It is better to transfer the list of actors separated by commas (or something else), and then using explode(); pull out the data.
Or with the help of regular expressions - actors[\/0-9]*/eactors[\/0-9]* // sketch, finish it yourself, I just described how to do it, I forgot how Laravel routes specify regular expressions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question