Файловый менеджер - Редактировать - /home/clickysoft/public_html/assets.clickysoft.net/app/Http/Resources/Api/AssetDetailResource.php
Назад
<?php namespace App\Http\Resources\Api; use App\Models\AssetTag; use Illuminate\Http\Resources\Json\JsonResource; class AssetDetailResource extends JsonResource { public function toArray($request) { $tags = []; $assetTags = AssetTag::with(["assigned_to"])->where("asset_id", $this->id)->whereNotNull("assigned_to_id")->get(); foreach ($assetTags as $assetTag) { $tags[] = [ "id" => $assetTag->id, "tag_name" => $assetTag->tag_name, "serial" => $assetTag->serial, 'bar_code' => $this->organization_id . "-" . $this->id . "-" . $assetTag->id, "assigned_to" => [ "id" => $assetTag->assigned_to_id, "name" => $assetTag->assigned_to->full_name, "email" => $assetTag->assigned_to->email, "contact_number" => $assetTag->assigned_to->contact_number, "avatar" => [ "thumbnail" => $assetTag->assigned_to->avatar?->thumbnail ?? "https://placehold.co/100x100/EEE/31343C?font-Lato&text=" . strtoupper(substr($assetTag->assigned_to->full_name, 0, 2)), "url" => $assetTag->assigned_to->avatar?->url ?? "https://placehold.co/200x200/EEE/31343C?font-Lato&text=" . strtoupper(substr($assetTag->assigned_to->full_name, 0, 2)), ], ], "assigned_at" => $assetTag->created_at, ]; } return [ 'id' => $this->id, 'asset_name' => $this->asset_name, 'description' => $this->description, 'qty' => $this->qty, 'notes' => $this->notes, 'asset_expiration_date' => $this->asset_expiration_date, 'next_audit_date' => $this->next_audit_date, 'purchase_date' => $this->purchase_date, 'eol_date' => $this->eol_date, 'purchase_cost' => $this->purchase_cost, 'assignable' => $this->assignable, 'maintainable' => $this->maintainable, 'company_id' => $this->company_id, 'branch_id' => $this->branch_id, 'supplier_id' => $this->supplier_id, 'manufacturer_id' => $this->manufacturer_id, 'category_id' => $this->category_id, 'asset_status_id' => $this->asset_status_id, 'currency_id' => $this->currency_id, 'tags' => $tags, 'status' => [ "id" => $this->asset_status->id, "name" => $this->asset_status->name, ], 'category' => [ "id" => $this->category->id, "name" => $this->category->name ], 'manufacturer' => [ "id" => $this->manufacturer->id, "name" => $this->manufacturer->name, ], 'supplier' => [ "id" => $this->supplier->id, "name" => $this->supplier->contact_name, "email" => $this->supplier->contact_email, "phone" => $this->supplier->contact_number, ], 'company' => [ "id" => $this->company->id, "name" => $this->company->name, ], 'branch' => [ "id" => $this->branch->id, "name" => $this->branch->name, ], 'currency' => $this->currency, "asset_image" => [ "thumbnail" => $this->asset_image?->thumbnail ?? "https://placehold.co/100x100/EEE/31343C?font-Lato&text=" . strtoupper(substr($this->asset_name, 0, 2)), "url" => $this->asset_image?->url ?? "https://placehold.co/200x200/EEE/31343C?font-Lato&text=" . strtoupper(substr($this->asset_name, 0, 2)), ], "asset_document" => $this->asset_document_url, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, ]; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка