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(), 'brand_id' => $this->brand_id, 'model_id' => $this->model_id, 'body_type' => $this->body_type, 'fuel_type' => $this->fuel_type, 'condition' => $this->condition, 'release_year' => $this->release_year, 'speed' => $this->speed, 'engine' => $this->engine, 'engine_type' => $this->engine_type, 'horse_power' => $this->horse_power, 'transmission' => $this->transmission, 'drive_train' => $this->drive_train, 'torque' => $this->torque, 'brake' => $this->brake, 'color' => $this->color, 'gearbox' => $this->gearbox, 'fuel_economy' => $this->fuel_economy, 'video_link' => $this->video_link, 'description' => $this->description, 'price' => $this->price, 'mileage' => $this->mileage, 'images' => $this->images, 'door_count' => $this->door_count, 'exterior_color' => $this->exterior_color, 'engine_size' => $this->engine_size, 'drive_type' => $this->drive_type, 'address' => $this->address, 'features' => $this->features, 'neighborhood' => $this->neighborhood, 'city' => $this->city, 'state' => $this->state, 'country' => $this->country, 'zip_code' => $this->zip_code, 'slug' => $this->slug, 'status' => $this->status, 'user_id' => $this->user_id, 'user_type' => $this->user_type, 'upload_folder' => $this->upload_folder, 'slider' => $this->slider, 'premium' => $this->premium, 'featured' => $this->featured, 'latitude' => $this->latitude, 'longitude' => $this->longitude, '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(''), ], ]; } }