Adjust the license offset if it exceeds the total of license seats

This commit is contained in:
Ivan Nieto Vivanco 2023-07-25 16:23:33 -06:00
parent a01cb26aac
commit c015264181

View file

@ -42,6 +42,11 @@ class LicenseSeatsController extends Controller
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $seats->count()) ? $seats->count() : abs($request->input('offset'));
if ($offset >= $total ){
$offset = 0;
}
$limit = app('api_limit_value');
$seats = $seats->skip($offset)->take($limit)->get();