From 876ff2ef7286677ec9ffd4eed3c471204631785d Mon Sep 17 00:00:00 2001 From: Ivan Nieto Date: Fri, 14 Dec 2018 20:08:33 -0600 Subject: [PATCH] Fixes #6341. Some style changes in this fix. (#6492) --- app/Http/Controllers/Api/LicensesController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 4f09c1af9e..ee8f991136 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -235,8 +235,12 @@ class LicensesController extends Controller } $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; - $total = $seats->count(); + + if($total < $offset){ + $offset = 0; + } + $seats = $seats->skip($offset)->take($limit)->get(); if ($seats) {