diff --git a/app/Http/Transformers/AssetsTransformer.php b/app/Http/Transformers/AssetsTransformer.php index e9abca65e1..3904e7b6ef 100644 --- a/app/Http/Transformers/AssetsTransformer.php +++ b/app/Http/Transformers/AssetsTransformer.php @@ -3,6 +3,7 @@ namespace App\Http\Transformers; use App\Helpers\Helper; use App\Models\Asset; +use App\Models\Setting; use Gate; use Illuminate\Database\Eloquent\Collection; @@ -20,6 +21,8 @@ class AssetsTransformer public function transformAsset(Asset $asset) { + $setting = Setting::getSettings(); + $array = [ 'id' => (int) $asset->id, 'name' => e($asset->name), @@ -64,6 +67,8 @@ class AssetsTransformer 'name'=> e($asset->defaultLoc->name) ] : null, 'image' => ($asset->getImageUrl()) ? $asset->getImageUrl() : null, + 'qr' => ($setting->qr_code=='1') ? config('app.url').'/uploads/barcodes/qr-'.str_slug($asset->asset_tag).'-'.str_slug($asset->id).'.png' : null, + 'alt_barcode' => ($setting->alt_barcode_enabled=='1') ? config('app.url').'/uploads/barcodes/'.str_slug($setting->alt_barcode).'-'.str_slug($asset->asset_tag).'.png' : null, 'assigned_to' => $this->transformAssignedTo($asset), 'warranty_months' => ($asset->warranty_months > 0) ? e($asset->warranty_months . ' ' . trans('admin/hardware/form.months')) : null, 'warranty_expires' => ($asset->warranty_months > 0) ? Helper::getFormattedDateObject($asset->warranty_expires, 'date') : null,