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, 'ref' => $this->ref, 'parent_id' => $this->parent_id, 'name' => $this->name, 'type' => $this->type, 'description' => $this->description, 'address' => $this->address, 'country_id' => $this->country_id, 'manager_id' => $this->manager_id, 'website_url' => $this->website_url, 'active_employees' => $this->active_employees, 'industry' => $this->industry, 'contact_email' => $this->contact_email, 'contact_address' => $this->contact_address, 'contact_phone' => $this->contact_phone, 'currency' => $this->currency, 'work_hour_start' => $this->work_hour_start, 'work_hour_end' => $this->work_hour_end, 'start_date_leave_cycle' => $this->start_date_leave_cycle, 'ext_dependants' => $this->ext_dependants, 'spon_dependants' => $this->spon_dependants, 'paid_leave_year' => $this->paid_leave_year, 'sick_leave_year' => $this->sick_leave_year, 'maternity_leave_year' => $this->maternity_leave_year, 'paternity_leave_year' => $this->paternity_leave_year, 'work_week_start' => $this->work_week_start, 'work_week_end' => $this->work_week_end, 'carried_forward' => $this->carried_forward, 'customercare_mobile' => $this->customercare_mobile, 'customercare_email' => $this->customercare_email, 'company_id' => $this->company_id, 'branch_id' => $this->branch_id, 'department_id' => $this->department_id, 'user_type' => $this->user_type, 'user_id' => $this->user_id, '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 = []; return $arr; } }