How to separate two pagination links which came from single controller method ? Dear Friends,
I am using Laravel 5.3. I created two similar paginations in my Home page using Controller method here : http://kopy.io/zddOe
My index.blade.php file is : http://kopy.io/528Ar
The problem is when I click the pagination of one item , the other page too also change. Please
suggest a simple method to fix this problem without affect another..
Waiting fast reply.
Thanks
Anes P A
Hi @insight
That is because both your paginations use the ?page=X query paratmeter. To overwrite that, simply try..
$foo = App\Foo::paginate(1, ['*'], 'foo'); // ?foo=X
$bar = App\Bar::paginate(1, ['*'], 'bar'); // ?bar=X
Dear Saeed,
I tried your code on controller but get error as FatalThrowableError in FrontendController.php line 7: Class 'App\Http\Controllers\App\Foo' not found.
Do you please download : http://kopy.io/zddOe and make changes appropriately and share here...
Thanks
Anes
Dear Saeed,
I can fix the problem by adding 2 more parameters like
paginate(1, [''], 'visited');
paginate(1, [' '], 'latest');
But could not keep the previous state of first pagination when click second.
Any trick to implement same?
Thanks
Anes
@insight
I made a video on how to use pagination with filters, you can see example there how you can keep both states..
Please sign in or create an account to participate in this conversation.