![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/medad.corals.io/Corals/modules/Medad/Transformers/ |
<?php namespace Corals\Modules\Medad\Transformers; use Corals\Foundation\Transformers\BaseTransformer; use Corals\Modules\Medad\Models\Quotation; class QuotationTransformer extends BaseTransformer { public function __construct($extras = []) { $this->resource_url = config('medad.models.quotation.resource_url'); parent::__construct($extras); } /** * @param Quotation $quotation * @return array * @throws \Throwable */ public function transform(Quotation $quotation) { $transformedArray = [ 'id' => $quotation->id, 'code' => $this->getModelLink($quotation, $quotation->code, ['data-size' => 'modal-lg']), 'notes' => generatePopover($quotation->notes) ?? '-', 'types_count' => $quotation->types_count ?? '-', 'total_quantity' => $quotation->total_quantity ?? '-', 'amount' => $quotation->amount ?? '-', 'status' => formatStatusAsLabels($quotation->status, config('medad.status.' . $quotation->status)) ?? '-', 'expiration_date' => $quotation->expiration_date ?? '-', 'owner' => optional($quotation->owner)->present('full_name') ?? '-', 'customer' => optional($quotation->customerCompany)->present('name') ?? '-', 'supplier' => optional($quotation)->supplierCompany->present('name') ?? '-', 'quotation_request' => optional($quotation->quotationRequest)->present('code') ?? '-', 'project' => optional($quotation->project)->present('name') ?? '-', 'created_at' => format_date($quotation->created_at), 'updated_at' => format_date($quotation->updated_at), 'action' => $this->actions($quotation) ]; return parent::transformResponse($transformedArray); } }