![]() 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/rentpix.corals.io/Corals/modules/RentPix/Transformers/ |
<?php namespace Corals\Modules\RentPix\Transformers; use Corals\Foundation\Transformers\BaseTransformer; use Corals\Modules\RentPix\Models\Unit; class UnitTransformer extends BaseTransformer { public function __construct($extras = []) { $this->resource_url = config('rentPix.models.unit.resource_url'); parent::__construct($extras); } /** * @param Unit $unit * @return array * * @throws \Throwable */ public function transform(Unit $unit) { $show_url = $unit->getShowURL(); $transformedArray = [ 'id' => $unit->id, 'code' => HtmlElement('a', ['href' => $unit->getShowURL()], $unit->code), 'code_without_link' => $unit->code, 'status' => formatStatusAsLabels($unit->status), 'vin' => $unit->vin, 'license' => $unit->license, 'engine' => $unit->engine, 'make' => $unit->make, 'model' => $unit->model, 'model_year' => $unit->model_year, 'rate_code' => optional($unit->rateCode)->title, 'last_inspection_at' => format_date($unit->last_inspection_at), 'created_at' => format_date($unit->created_at), 'updated_at' => format_date($unit->updated_at), 'action' => $this->actions($unit), ]; return parent::transformResponse($transformedArray); } }