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(), 'asset_group' => $this->asset_group, 'building_code' => $this->building_code, 'asset_level3' => $this->asset_level3, 'local_description' => $this->local_description, 'asset_description' => $this->asset_description, 'asset_classification_number' => $this->asset_classification_number, 'asset_classification_name' => $this->asset_classification_name, 'quantity' => $this->quantity, 'quantity_type' => $this->quantity_type, 'consequence' => $this->consequence, 'likelihood' => $this->likelihood, 'criticality_index' => $this->criticality_index, 'criticality_names' => $this->criticality_names, 'purchase_date' => $this->purchase_date, 'assessment_date' => $this->assessment_date, 'book_expected_life' => $this->book_expected_life, 'book_remaining_life' => $this->book_remaining_life, 'condition' => $this->condition, 'unit_cost' => $this->unit_cost, 'replacement_cost' => $this->replacement_cost, 'actual_remaining_life' => $this->actual_remaining_life, 'priority' => $this->priority, 'budget' => $this->budget, 'user_id' => $this->user_id, 'user_type' => $this->user_type, 'slug' => $this->slug, '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(''), ], ]; } }