getRouteKey(); } public function title() { if ($this->title != '') { return $this->title; } if ($this->name != '') { return $this->name; } return 'None'; } public function toArray() { return [ 'id' => $this->getRouteKey(), 'title' => $this->title(), 'name' => $this->name, 'slug' => $this->slug, 'user_id' => $this->user_id, 'status' => $this->status, 'image' => $this->image, 'address' => $this->address, 'contact' => $this->contact, 'brand' => $this->brand, 'Email' => $this->Email, 'region' => $this->region, 'coordinates' => $this->coordinates, 'hour' => $this->hour, 'monday' => $this->monday, 'tuesday' => $this->tuesday, 'wednesday' => $this->wednesday, 'thursday' => $this->thursday, 'friday' => $this->friday, 'saturday' => $this->saturday, 'sunday' => $this->sunday, 'coordinate' => $this->coordinate, '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(''), ], ]; } }