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_id' => $this->asset_id, 'asset_type_id' => $this->asset_type_id, 'user_id' => $this->user_id, 'assessed_by' => $this->assessed_by, 'consequence_m1' => $this->consequence_m1, 'likelyhood_m1' => $this->likelyhood_m1, 'criticality_index_m1' => $this->criticality_index_m1, 'criticality_name_m1' => $this->criticality_name_m1, 'assessment_date' => $this->assessment_date, 'condition_m' => $this->condition_m, 'conditional_meaning_m' => $this->conditional_meaning_m, 'condition_notes' => $this->condition_notes, 'scope' => $this->scope, 'unit_cost' => $this->unit_cost, 'actual_remaining_life' => $this->actual_remaining_life, 'actual_replacement_date' => $this->actual_replacement_date, 'user_type' => $this->user_type, '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(''), ], ]; } /** * Get additional data that should be returned with the resource array. * * @param \Illuminate\Http\Request $request * @return array */ public function with($request) { return [ 'meta' => [ 'exists' => $this->exists(), 'link' => $this->itemLink(), 'upload_url' => $this->getUploadURL(''), 'workflow' => $this->workflows(), 'actions' => $this->actions(), ], ]; } private function workflows() { $arr = []; return $arr; } private function actions() { $arr = []; return $arr; } }