getRouteKey(); } public function title() { if ($this->title != '') { return $this->title; } if ($this->name != '') { return $this->name; } return 'None'; } public function toArray($request) { return [ 'id' => $this->getRouteKey(), 'title' => $this->title(), 'name' => $this->name, 'book_expected_life' => $this->book_expected_life, 'image_no' => $this->image_no, 'replacement_unit_cost' => $this->replacement_unit_cost, 'qty_type' => $this->qty_type, 'expected_life_source' => $this->expected_life_source, 'removal_cost' => $this->removal_cost, 'removal_unit_cost_source' => $this->removal_unit_cost_source, 'supply_install_cost' => $this->supply_install_cost, 'supply_install_cost_source' => $this->supply_install_cost_source, 'design_fees' => $this->design_fees, 'contingency' => $this->contingency, 'model' => $this->model, 'system' => $this->system, 'category' => $this->category, 'created_at' => !is_null($this->created_at) ? $this->created_at->format('Y-m-d H:i:s') : null, 'updated_at' => !is_null($this->updated_at) ? $this->updated_at->format('Y-m-d H:i:s') : null, 'meta' => [ 'exists' => $this->exists(), 'link' => $this->itemLink(), 'upload_url' => $this->getUploadURL(''), ], ]; } }