Skip to content

Commit

Permalink
🚸 add pagination to backend statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKrisKrisu committed Dec 26, 2024
1 parent d0245b7 commit 3144f4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Frontend/Admin/StatusEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function renderMain(Request $request): View {
$validated = $request->validate([
'userQuery' => ['nullable', 'max:255'],
]);
$lastStatuses = Status::orderBy('created_at', 'desc')->limit(20);
$lastStatuses = Status::orderBy('created_at', 'desc');

if (isset($validated['userQuery'])) {
$lastStatuses = $lastStatuses->whereIn(
Expand All @@ -34,7 +34,7 @@ public function renderMain(Request $request): View {
}

return view('admin.status.main', [
'lastStatuses' => $lastStatuses->get(),
'lastStatuses' => $lastStatuses->paginate(10),
]);
}

Expand Down
4 changes: 3 additions & 1 deletion resources/views/admin/status/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,15 @@
</td>
<td>
<small>{{__('status.visibility.' . $status->visibility->value)}}</small>
<br />
<br/>
<small>{{__('stationboard.business.' . strtolower($status->business->name))}}</small>
</td>
</tr>
@endforeach
</tbody>
</table>

{{$lastStatuses->links()}}
</div>
</div>
</div>
Expand Down

0 comments on commit 3144f4d

Please sign in to comment.