Created
July 21, 2024 15:29
-
-
Save Shaz3e/fca61f81e21e4106941c58aa57ecf046 to your computer and use it in GitHub Desktop.
Revisions
-
Shaz3e created this gist
Jul 21, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ // In your livewire blade @php // Get the current page number, default to 1 if not set $currentPage = $dataSet->currentPage(); // Get the number of items per page $perPage = $dataSet->perPage(); // Calculate the starting index $i = ($currentPage - 1) * $perPage + 1; @endphp // In your livewire component public function render() { $query = User::query(); $dataSet = $query->paginate(10); return view('livewire.user-list', [ 'dataSet' => $dataSet, ]); }