문제

$dbDetails= Contract::where( 'a', 'LIKE', "%$searchText%" )
            ->orWhere( 'b', 'LIKE', "%$searchText%" )
            ->orWhere( 'c', 'LIKE', "%$searchText%" )
            ->orWhere( 'd', 'LIKE', "%$searchText%" )
            ->paginate($paginationNumber);

This is my controller and am getting the pagination links in view by using

{{ $contractDetails->appends(array('search' => 'test'))->links() }}

So here is how my url looks like

domain.com/search?page=2&search=test

Iam wondering how can i get the second page with 10 number of rows?

Can anyone help me to solve this?
Thanks in advance

도움이 되었습니까?

해결책

I would say pas the value 10 as a get parameter, read it and pass it to paginate->().

$dbDetails= Contract::where( 'a', 'LIKE', "%$searchText%" )
            ->orWhere( 'b', 'LIKE', "%$searchText%" )
            ->orWhere( 'c', 'LIKE', "%$searchText%" )
            ->orWhere( 'd', 'LIKE', "%$searchText%" )
            ->paginate(Input::get('paginate'));

This is my controller and am getting the pagination links in view by using

{{ $contractDetails->appends(array('search' => 'test', 'paginate' => 10))->links() }}

So here is how my url should look like

domain.com/search?page=2&search=test&paginate=10

If I understand correctly this is what u want.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top