From 05190fd34cdea5a3b16caa1af640492c7632be71 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Tue, 28 Nov 2017 09:50:57 +0100 Subject: [PATCH] Implement pagination for the assistance requests index view --- .../Views/AnnotationAssistanceRequestController.php | 6 +++++- src/resources/views/index.blade.php | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Http/Controllers/Views/AnnotationAssistanceRequestController.php b/src/Http/Controllers/Views/AnnotationAssistanceRequestController.php index 2004576..cf348a4 100644 --- a/src/Http/Controllers/Views/AnnotationAssistanceRequestController.php +++ b/src/Http/Controllers/Views/AnnotationAssistanceRequestController.php @@ -156,7 +156,11 @@ public function index(Guard $auth, Request $request) ->when($type === 'closed', function ($query) { return $query->whereNotNull('closed_at'); }) - ->get(); + ->paginate(10); + + // Add the URL parameter to the paginator so the pagination links are + // constructed properly. + $requests->appends('t', $type); return view('ananas::index', compact('requests', 'type')); } diff --git a/src/resources/views/index.blade.php b/src/resources/views/index.blade.php index ddac645..25c1502 100644 --- a/src/resources/views/index.blade.php +++ b/src/resources/views/index.blade.php @@ -39,6 +39,9 @@ @endforelse +