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(), 'slug' => $this->slug, 'type' => $this->type, 'ref' => $this->ref, 'title' => $this->title, 'name' => $this->name, 'mobile' => $this->mobile, 'email' => $this->email, 'phone' => $this->phone, 'fax' => $this->fax, 'website' => $this->website, 'dob' => $this->dob, 'nationality' => $this->nationality, 'religion' => $this->religion, 'languages' => $this->languages, 'address' => $this->address, 'phones' => $this->phones, 'socialmedias' => $this->socialmedias, 'emails' => $this->emails, 'people' => $this->people, 'events' => $this->events, 'company' => $this->company, 'license_number' => $this->license_number, 'designation' => $this->designation, 'department' => $this->department, 'passport_no' => $this->passport_no, 'has_id' => $this->has_id, 'id_number' => $this->id_number, 'documents' => $this->documents, 'notes' => $this->notes, 'remarks' => $this->remarks, 'tags' => $this->tags, 'user_id' => $this->user_id, 'user_type' => $this->user_type, '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(''), 'workflow' => $this->workflows(), 'actions' => $this->actions(), ], ]; } /** * 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(), ], ]; } /** * Get the workflows for the resource. * * @return array */ private function workflows() { $arr = []; return $arr; } /** * Get the actions for the resource. * * @return array */ private function actions() { $arr = []; $actions = $this->resource->actions()->details(); foreach ($actions as $key => $action) { $name = $action->name(); $arr[$key]['url'] = guard_url('contact/contact//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('contact::contact.actions.' . $name); } return $arr; } }