Aldair Aquino
Aldair Aquino

Reputation: 16

How get multiple URL value in Laravel 5.2

How to get multiple argument values in Laravel 5.2?

Example:

http://localhost:8000/print?id=1&id=3

How get the values of ids in an array let's say [1,2]?

Upvotes: 0

Views: 240

Answers (1)

Amit Gupta
Amit Gupta

Reputation: 17668

You can send the data using [] in the url as:

http://localhost:8000/print?id[]=1&id[]=3

Then you can get it in controller as:

$request->get('id') // returns [1,3]

Upvotes: 3

Related Questions