Add requestable to asset model api results (#7577)

Nice, thanks!
This commit is contained in:
herroworrd 2019-12-06 10:33:06 -08:00 committed by snipe
parent 7225b53986
commit 3fbfb0c658
2 changed files with 3 additions and 1 deletions

View file

@ -30,7 +30,7 @@ class AssetModelsController extends Controller
public function index(Request $request) public function index(Request $request)
{ {
$this->authorize('view', AssetModel::class); $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([ $assetmodels = AssetModel::select([
'models.id', 'models.id',
@ -38,6 +38,7 @@ class AssetModelsController extends Controller
'models.name', 'models.name',
'model_number', 'model_number',
'eol', 'eol',
'requestable',
'models.notes', 'models.notes',
'models.created_at', 'models.created_at',
'category_id', 'category_id',

View file

@ -45,6 +45,7 @@ class AssetModelsTransformer
'name'=> e($assetmodel->fieldset->name) 'name'=> e($assetmodel->fieldset->name)
] : null, ] : null,
'eol' => ($assetmodel->eol > 0) ? $assetmodel->eol .' months': 'None', 'eol' => ($assetmodel->eol > 0) ? $assetmodel->eol .' months': 'None',
'requestable' => ($assetmodel->requestable =='1') ? true : false,
'notes' => e($assetmodel->notes), 'notes' => e($assetmodel->notes),
'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'), 'created_at' => Helper::getFormattedDateObject($assetmodel->created_at, 'datetime'),
'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'), 'updated_at' => Helper::getFormattedDateObject($assetmodel->updated_at, 'datetime'),