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, 'category_id' => $this->category_id, 'team_id' => $this->team_id, 'contact_id' => $this->contact_id, 'tenant_id' => $this->tenant_id, 'agent_id' => $this->agent_id, 'exclusive' => $this->exclusive, 'name' => $this->name, 'ref' => $this->ref, 'ref_pf' => $this->ref_pf, 'unit_no' => $this->unit_no, 'unit_type' => $this->unit_type, 'floor' => $this->floor, 'maintain_sqft' => $this->maintain_sqft, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'country_id' => $this->country_id, 'state_id' => $this->state_id, 'location_id' => $this->location_id, 'sublocation_id' => $this->sublocation_id, 'property_id' => $this->property_id, 'building_no' => $this->building_no, 'tower_name' => $this->tower_name, 'beds' => $this->beds, 'fitted' => $this->fitted, 'construction' => $this->construction, 'baths' => $this->baths, 'half_bath' => $this->half_bath, 'furnished' => $this->furnished, 'appliances' => $this->appliances, 'view' => $this->view, 'bua' => $this->bua, 'price' => $this->price, 'plot' => $this->plot, 'poa' => $this->poa, 'frequency' => $this->frequency, 'cheques' => $this->cheques, 'parking' => $this->parking, 'commercial' => $this->commercial, 'description' => $this->description, 'description_more' => $this->description_more, 'documents' => $this->documents, 'photos' => $this->photos, 'floor_plans' => $this->floor_plans, 'deposit' => $this->deposit, 'deposit_aed' => $this->deposit_aed, 'portals' => $this->portals, 'medias' => $this->medias, 'features' => $this->features, 'amenities' => $this->amenities, 'features_intl' => $this->features_intl, 'featured' => $this->featured, 'str' => $this->str, 'source' => $this->source, 'sub_source' => $this->sub_source, 'next_available' => $this->next_available, 'notes' => $this->notes, 'rented' => $this->rented, 'rented_price' => $this->rented_price, 'rented_cheques' => $this->rented_cheques, 'rented_at' => $this->rented_at, 'rented_until' => $this->rented_until, 'maintenance_fee' => $this->maintenance_fee, 'type' => $this->type, 'trakheesi' => $this->trakheesi, 'status' => $this->status, 'related_listing' => $this->related_listing, 'published_at' => $this->published_at, 'unpublished_at' => $this->unpublished_at, 'assigned_to' => $this->assigned_to, 'watermark' => $this->watermark, 'expiry_at' => $this->expiry_at, 'upload_folder' => $this->upload_folder, 'user_id' => $this->user_id, 'user_type' => $this->user_type, '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 = []; $workflow = $this->resource->workflow(); foreach ($workflow->transitions($this) as $key => $transition) { $name = $transition->getName(); $arr[$key]['url'] = guard_url('property/property/workflow/' . $this->getRouteKey() . '/' . $name); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $workflow->form($transition); $arr[$key]['label'] = trans('property::property.workflow.' . $name); } 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('property/property//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('property::property.actions.' . $name); } return $arr; } }