From 3fbfb0c658f99adb0b83bab39185b4ae67c6da93 Mon Sep 17 00:00:00 2001 From: herroworrd <47008367+herroworrd@users.noreply.github.com> Date: Fri, 6 Dec 2019 10:33:06 -0800 Subject: [PATCH] Add requestable to asset model api results (#7577) Nice, thanks! --- app/Http/Controllers/Api/AssetModelsController.php | 3 ++- app/Http/Transformers/AssetModelsTransformer.php | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Api/AssetModelsController.php b/app/Http/Controllers/Api/AssetModelsController.php index dfd3832242..405436ca79 100644 --- a/app/Http/Controllers/Api/AssetModelsController.php +++ b/app/Http/Controllers/Api/AssetModelsController.php @@ -30,7 +30,7 @@ class AssetModelsController extends Controller public function index(Request $request) { $this->authorize('view', AssetModel::class); - $allowed_columns = ['id','image','name','model_number','eol','notes','created_at','manufacturer','assets_count']; + $allowed_columns = ['id','image','name','model_number','eol','notes','created_at','manufacturer','requestable', 'assets_count']; $assetmodels = AssetModel::select([ 'models.id', @@ -38,6 +38,7 @@ class AssetModelsController extends Controller 'models.name', 'model_number', 'eol', + 'requestable', 'models.notes', 'models.created_at', 'category_id', diff --git a/app/Http/Transformers/AssetModelsTransformer.php b/app/Http/Transformers/AssetModelsTransformer.php index 66a10cb159..4b2658e739 100644 --- a/app/Http/Transformers/AssetModelsTransformer.php +++ b/app/Http/Transformers/AssetModelsTransformer.php @@ -45,6 +45,7 @@ class AssetModelsTransformer 'name'=> e($assetmodel->fieldset->name) ] : null, 'eol' => ($assetmodel->eol > 0) ? $assetmodel->eol .' months': 'None', + 'requestable' => ($assetmodel->requestable =='1') ? true : false, 'notes' => e($assetmodel->notes), 'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'),