Skip to content

Commit

Permalink
Update AssetsTransformer.php
Browse files Browse the repository at this point in the history
on list of assets display EOL rate in months if purchase date and eol date are set, otherwise null (not display anything)
  • Loading branch information
Robert-Azelis authored Oct 22, 2023
1 parent bd195a6 commit 5ae09b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Http/Transformers/AssetsTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\Setting;
use Illuminate\Support\Facades\Gate;
use Illuminate\Database\Eloquent\Collection;
use Carbon\Carbon;


class AssetsTransformer
Expand Down Expand Up @@ -38,7 +39,7 @@ public function transformAsset(Asset $asset)
'byod' => ($asset->byod ? true : false),

'model_number' => (($asset->model) && ($asset->model->model_number)) ? e($asset->model->model_number) : null,
'eol' => (($asset->model) && ($asset->model->eol != '')) ? $asset->model->eol : null,
'eol' => (($asset->asset_eol_date != '') && ($asset->purchase_date != '')) ? Carbon::parse($asset->asset_eol_date)->diffInMonths($asset->purchase_date).' months' : null,
'asset_eol_date' => ($asset->asset_eol_date != '') ? Helper::getFormattedDateObject($asset->asset_eol_date, 'date') : null,
'status_label' => ($asset->assetstatus) ? [
'id' => (int) $asset->assetstatus->id,
Expand Down

0 comments on commit 5ae09b7

Please sign in to comment.