Tricks

Fast table pagination

Jul 12, 2022
Dan Harrin
Admin panel, Integration, Table builder

You may use hammerstone/fast-paginate by overriding the paginateTableQuery() method on your Livewire component.

If you're using the admin panel, your Livewire component is the List page of a resource, or a table widget.

The theory for this feature can be found here.

use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Database\Eloquent\Builder;
 
protected function paginateTableQuery(Builder $query): Paginator
{
return $query->fastPaginate($this->getTableRecordsPerPage());
}

No comments yet…