Display pause in Laravel

I have a page listing apartments depending on the date of booking, for example,

mypage.com/finder?date-from=2011-03-04&date-to=2011-03-12

That's right, I get the date-from and date-get from url and look for a database with these values. The problem is when I paginate and I click to go to another page that the URL changes to.

mypage.com/finder?page=9 

and get an error. Value must be provided

The correct URL must be

mypage.com/finder?date-from=2011-03-04&date-to=2011-03-12&page=9

I use paginate on the controller and $ searchResult-> links (); to create links

What can I do by passing date values ​​from page to page to work with paginated pages?

thank

+4
source share
2 answers

, :

$searchResult->appends(array(
    'date-from' => Input::get('date-from'),
    'date-to'   => Input::get('date-to'),
));

: .


:

$searchResult->appends( Input::only('data-from', 'date-to') );

.

+8

Source: https://habr.com/ru/post/1529910/


All Articles