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(), 'from_id' => $this->from_id, 'from_type' => $this->from_type, 'from_email' => $this->from_email, 'to_id' => $this->to_id, 'to_type' => $this->to_type, 'to_email' => $this->to_email, 'subject' => $this->subject, 'message' => $this->message, 'folder' => $this->folder, 'starred' => $this->starred, 'readed' => $this->readed, 'labels' => $this->labels, 'user_id' => $this->user_id, 'user_type' => $this->user_type, 'slug' => $this->slug, 'upload_folder' => $this->upload_folder, '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; } }