I have a simple foreach loop that loops through the current week dates in Y-m-d
format:
@foreach($dates as $date)
<a href="{{route('consols.index', array_merge(\Request::query(), ['date' => date('Y-m-d', strtotime($date))]))}}">{{date('l', strtotime($date))}}</a>
@endforeach
With above, I can simply click on the anchor link, and the specific date will be appended:
example.org/consols?date=2020-03-04
Now I use this to filter a specific SQL query and I wish to be able to filter for multiple dates. For example:
example.org/consols?date=2020-03-04&date=2020-03-05&date=2020-03-06
Where in above example, I wish to send 3 dates as query parameters.
If I simply append another &date=
to the already present ?date
, it will only select the last date=
in the query string.
How can I, with PHP, send multiple variables in my URL with the same parameter name?