diff --git a/app/Http/Controllers/Api/AccessoriesController.php b/app/Http/Controllers/Api/AccessoriesController.php index 1cc57acebc..5c74996f62 100644 --- a/app/Http/Controllers/Api/AccessoriesController.php +++ b/app/Http/Controllers/Api/AccessoriesController.php @@ -52,7 +52,7 @@ class AccessoriesController extends Controller $offset = (($accessories) && (request('offset') > $accessories->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; diff --git a/app/Http/Controllers/Api/AssetMaintenancesController.php b/app/Http/Controllers/Api/AssetMaintenancesController.php index 28a9810063..535147a6bc 100644 --- a/app/Http/Controllers/Api/AssetMaintenancesController.php +++ b/app/Http/Controllers/Api/AssetMaintenancesController.php @@ -47,7 +47,7 @@ class AssetMaintenancesController extends Controller $offset = (($maintenances) && (request('offset') > $maintenances->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $allowed_columns = [ diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index f1274ba563..08a2cd68d0 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -63,7 +63,7 @@ class AssetModelsController extends Controller $offset = (($assetmodels) && (request('offset') > $assetmodels->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') < $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'models.created_at'; diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index aa1b013726..86a68aa686 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -147,7 +147,7 @@ class AssetsController extends Controller $offset = (($assets) && (request('offset') > $assets->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; diff --git a/app/Http/Controllers/Api/CategoriesController.php b/app/Http/Controllers/Api/CategoriesController.php index 183837baf9..beafb802e7 100644 --- a/app/Http/Controllers/Api/CategoriesController.php +++ b/app/Http/Controllers/Api/CategoriesController.php @@ -33,7 +33,7 @@ class CategoriesController extends Controller $offset = (($categories) && (request('offset') > $categories->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'assets_count'; diff --git a/app/Http/Controllers/Api/CompaniesController.php b/app/Http/Controllers/Api/CompaniesController.php index d686a8aeca..7a4fe2c218 100644 --- a/app/Http/Controllers/Api/CompaniesController.php +++ b/app/Http/Controllers/Api/CompaniesController.php @@ -44,7 +44,7 @@ class CompaniesController extends Controller $offset = (($companies) && (request('offset') > $companies->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/ComponentsController.php b/app/Http/Controllers/Api/ComponentsController.php index 6638c0864f..cfaff1bdb2 100644 --- a/app/Http/Controllers/Api/ComponentsController.php +++ b/app/Http/Controllers/Api/ComponentsController.php @@ -46,7 +46,7 @@ class ComponentsController extends Controller $offset = (($components) && (request('offset') > $components->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $allowed_columns = ['id','name','min_amt','order_number','serial','purchase_date','purchase_cost','company','category','qty','location','image']; $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; diff --git a/app/Http/Controllers/Api/ConsumablesController.php b/app/Http/Controllers/Api/ConsumablesController.php index 2fddcd0c8b..3604b3e065 100644 --- a/app/Http/Controllers/Api/ConsumablesController.php +++ b/app/Http/Controllers/Api/ConsumablesController.php @@ -47,7 +47,7 @@ class ConsumablesController extends Controller $offset = (($consumables) && (request('offset') > $consumables->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $allowed_columns = ['id','name','order_number','min_amt','purchase_date','purchase_cost','company','category','model_number', 'item_no', 'manufacturer','location','qty','image']; $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; diff --git a/app/Http/Controllers/Api/DepartmentsController.php b/app/Http/Controllers/Api/DepartmentsController.php index 409e30c224..5a3fcdd29d 100644 --- a/app/Http/Controllers/Api/DepartmentsController.php +++ b/app/Http/Controllers/Api/DepartmentsController.php @@ -42,7 +42,7 @@ class DepartmentsController extends Controller $offset = (($departments) && (request('offset') > $departments->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/DepreciationsController.php b/app/Http/Controllers/Api/DepreciationsController.php index c8cd92d155..2cfb7fcc52 100644 --- a/app/Http/Controllers/Api/DepreciationsController.php +++ b/app/Http/Controllers/Api/DepreciationsController.php @@ -31,7 +31,7 @@ class DepreciationsController extends Controller $offset = (($depreciations) && (request('offset') > $depreciations->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/GroupsController.php b/app/Http/Controllers/Api/GroupsController.php index 5cfed31be2..933b5423d8 100644 --- a/app/Http/Controllers/Api/GroupsController.php +++ b/app/Http/Controllers/Api/GroupsController.php @@ -31,7 +31,7 @@ class GroupsController extends Controller $offset = (($groups) && (request('offset') > $groups->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/LicensesController.php b/app/Http/Controllers/Api/LicensesController.php index 76bf9115a7..1835570236 100644 --- a/app/Http/Controllers/Api/LicensesController.php +++ b/app/Http/Controllers/Api/LicensesController.php @@ -85,7 +85,7 @@ class LicensesController extends Controller $offset = (($licenses) && (request('offset') > $licenses->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.php index c61dddd620..3aa895ef45 100644 --- a/app/Http/Controllers/Api/LocationsController.php +++ b/app/Http/Controllers/Api/LocationsController.php @@ -54,7 +54,7 @@ class LocationsController extends Controller $offset = (($locations) && (request('offset') > $locations->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/ManufacturersController.php b/app/Http/Controllers/Api/ManufacturersController.php index 60da5aadef..cbdf106c11 100644 --- a/app/Http/Controllers/Api/ManufacturersController.php +++ b/app/Http/Controllers/Api/ManufacturersController.php @@ -42,7 +42,7 @@ class ManufacturersController extends Controller $offset = (($manufacturers) && (request('offset') > $manufacturers->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php index 261771959d..b90ea25c80 100644 --- a/app/Http/Controllers/Api/StatuslabelsController.php +++ b/app/Http/Controllers/Api/StatuslabelsController.php @@ -33,7 +33,7 @@ class StatuslabelsController extends Controller $offset = (($statuslabels) && (request('offset') > $statuslabels->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/SuppliersController.php b/app/Http/Controllers/Api/SuppliersController.php index f95070d3d2..3b31781969 100644 --- a/app/Http/Controllers/Api/SuppliersController.php +++ b/app/Http/Controllers/Api/SuppliersController.php @@ -36,7 +36,7 @@ class SuppliersController extends Controller $offset = (($suppliers) && (request('offset') > $suppliers->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); $order = $request->input('order') === 'asc' ? 'asc' : 'desc'; $sort = in_array($request->input('sort'), $allowed_columns) ? $request->input('sort') : 'created_at'; diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index c8ae878f3f..cd5bc0997c 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -90,7 +90,7 @@ class UsersController extends Controller $offset = (($users) && (request('offset') > $users->count())) ? 0 : request('offset', 0); // Check to make sure the limit is not higher than the max allowed - (config('app.max_results') >= $request->input('limit')) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); switch ($request->input('sort')) {