mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Tighter asset API responses, sanitization
This commit is contained in:
parent
cdb6349035
commit
f1592aa63f
|
@ -21,23 +21,23 @@ class AssetsTransformer
|
||||||
{
|
{
|
||||||
$array = [
|
$array = [
|
||||||
'id' => $asset->id,
|
'id' => $asset->id,
|
||||||
'name' => $asset->name,
|
'name' => e($asset->name),
|
||||||
'asset_tag' => $asset->asset_tag,
|
'asset_tag' => e($asset->asset_tag),
|
||||||
'serial' => $asset->serial,
|
'serial' => e($asset->serial),
|
||||||
'model' => ($asset->model) ? ['id' => $asset->model->id,'name'=> $asset->model->name] : '',
|
'model' => ($asset->model) ? ['id' => $asset->model->id,'name'=> e($asset->model->name)] : '',
|
||||||
'model_number' => $asset->model_number,
|
'model_number' => e($asset->model_number),
|
||||||
'status_label' => ($asset->assetstatus) ? $asset->assetstatus : null,
|
'status_label' => ($asset->assetstatus) ? ['id' => $asset->assetstatus->id,'name'=> e($asset->assetstatus->name)] : null,
|
||||||
'last_checkout' => $asset->last_checkout,
|
'last_checkout' => $asset->last_checkout,
|
||||||
'category' => ($asset->model->category) ? $asset->model->category : null,
|
'category' => ($asset->model->category) ? ['id' => $asset->model->category->id,'name'=> e($asset->model->category->name)] : null,
|
||||||
'manufacturer' => ($asset->model->manufacturer) ? $asset->model->manufacturer : null,
|
'manufacturer' => ($asset->model->manufacturer) ? ['id' => $asset->model->manufacturer->id,'name'=> e($asset->model->manufacturer->name)] : null,
|
||||||
'notes' => $asset->notes,
|
'notes' => $asset->notes,
|
||||||
'expected_checkin' => $asset->expected_checkin,
|
'expected_checkin' => $asset->expected_checkin,
|
||||||
'order_number' => $asset->order_number,
|
'order_number' => $asset->order_number,
|
||||||
'company' => ($asset->company) ? $asset->company : null,
|
'company' => ($asset->company) ? ['id' => $asset->company->id,'name'=> e($asset->company->name)] : null,
|
||||||
'location' => ($asset->assetLoc) ? $asset->assetLoc : null,
|
'location' => ($asset->assetLoc) ? ['id' => $asset->assetLoc->id,'name'=> e($asset->assetLoc->name)] : null,
|
||||||
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
|
'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null,
|
||||||
'assigned_to' => ($asset->assigneduser) ? (new UsersTransformer)->transformUser($asset->assigneduser) : null,
|
'assigned_to' => ($asset->assigneduser) ? (new UsersTransformer)->transformUser($asset->assigneduser) : null,
|
||||||
'warranty' => ($asset->warranty_months > 0) ? $asset->warranty_months.' '.trans('admin/hardware/form.months') : null,
|
'warranty' => ($asset->warranty_months > 0) ? e($asset->warranty_months).' '.trans('admin/hardware/form.months') : null,
|
||||||
'warranty_expires' => ($asset->warranty_months > 0) ? $asset->present()->warrantee_expires() : null,
|
'warranty_expires' => ($asset->warranty_months > 0) ? $asset->present()->warrantee_expires() : null,
|
||||||
'created_at' => $asset->created_at,
|
'created_at' => $asset->created_at,
|
||||||
'purchase_date' => $asset->purchase_date,
|
'purchase_date' => $asset->purchase_date,
|
||||||
|
|
Loading…
Reference in a new issue