Skip to content

Commit

Permalink
Implement pagination for the assistance requests index view
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Nov 28, 2017
1 parent 15932ef commit 05190fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
3 changes: 3 additions & 0 deletions src/resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
</li>
@endforelse
</ul>
<nav class="text-center">
{{$requests->links()}}
</nav>
</div>
</div>
</div>
Expand Down

0 comments on commit 05190fd

Please sign in to comment.