A simplier way is to use
{{ $posts->appends(request()->except('page'))->links() }}.
docs https://laravel.com/docs/5.6/pagination#displaying-pagination-results
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
In one of the online project I have seen we can pass arguments in laravel paginator by this way.
$aData->paginate($aRequest['rowCount'], ['*'], 'page', $aRequest['current']) //where $Data is an eloquent query object
But I didn't see any documentation regarding this. I checked the official documentation also, but not seeing such an implementation.
Basically I need data table pagination (with out other plugins). So I need to get the total record count also. So by using paginate function I think I can implement in an effective way.
Can anybody have any suggestion regarding this.
Thanks,
Please or to participate in this conversation.