Moved limit and offset to after additional qualifiers

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-01-05 11:59:31 +00:00
parent 98ef687e9c
commit f8a21bdb2d

View file

@ -192,11 +192,6 @@ class UsersController extends Controller
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $users->count()) ? $users->count() : app('api_offset_value');
$limit = app('api_limit_value');
switch ($request->input('sort')) {
case 'manager':
$users = $users->OrderManager($order);
@ -273,7 +268,17 @@ class UsersController extends Controller
}
$users = Company::scopeCompanyables($users);
// Make sure the offset and limit are actually integers and do not exceed system limits
$offset = ($request->input('offset') > $users->count()) ? $users->count() : app('api_offset_value');
$limit = app('api_limit_value');
\Log::debug('Requested offset: '. $request->input('offset'));
\Log::debug('App offset: '. app('api_offset_value'));
\Log::debug('Actual offset: '. $offset);
\Log::debug('Limit: '. $limit);
$total = $users->count();
$users = $users->skip($offset)->take($limit)->get();