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, 'organization_id' => $this->organization_id, 'branch_id' => $this->branch_id, 'department_id' => $this->department_id, 'division_id' => $this->division_id, 'contact_id' => $this->contact_id, 'developer_id' => $this->developer_id, 'country_id' => $this->country_id, 'region_id' => $this->region_id, 'location_id' => $this->location_id, 'sublocation_id' => $this->sublocation_id, 'building_id' => $this->building_id, 'tower_id' => $this->tower_id, 'category_type' => $this->category_type, 'category' => $this->category, 'property_for' => $this->property_for, 'property_type' => $this->property_type, 'status' => $this->status, 'premium' => $this->premium, 'exclusive' => $this->exclusive, 'title' => $this->title, 'ref' => $this->ref, 'ref_pf' => $this->ref_pf, 'ref_byt' => $this->ref_byt, 'unit' => $this->unit, 'type' => $this->type, 'floor' => $this->floor, 'beds' => $this->beds, 'baths' => $this->baths, 'parking' => $this->parking, 'bua' => $this->bua, 'price' => $this->price, 'maintenance' => $this->maintenance, 'description' => $this->description, 'description_more' => $this->description_more, 'construction_status' => $this->construction_status, 'completion_on' => $this->completion_on, 'furnishing' => $this->furnishing, 'appliances' => $this->appliances, 'views' => $this->views, 'plot' => $this->plot, 'price_on_request' => $this->price_on_request, 'frequency' => $this->frequency, 'cheques' => $this->cheques, 'parking_no' => $this->parking_no, 'photos' => $this->photos, 'floor_plans' => $this->floor_plans, 'conmmission_split' => $this->conmmission_split, 'deposit' => $this->deposit, 'deposit_amount' => $this->deposit_amount, 'portals' => $this->portals, 'medias' => $this->medias, 'features' => $this->features, 'available_from' => $this->available_from, 'rented' => $this->rented, 'rented_price' => $this->rented_price, 'rented_cheques' => $this->rented_cheques, 'rent_start' => $this->rent_start, 'rent_end' => $this->rent_end, 'trakheesi' => $this->trakheesi, 'project' => $this->project, 'portal_settings' => $this->portal_settings, 'settings' => $this->settings, 'latitude' => $this->latitude, 'longitude' => $this->longitude, 'notes' => $this->notes, 'documents' => $this->documents, 'upload_folder' => $this->upload_folder, 'assign_to' => $this->assign_to, 'referred_by' => $this->referred_by, 'marketed_by' => $this->marketed_by, 'created_by' => $this->created_by, 'published_at' => $this->published_at, 'unpublished_at' => $this->unpublished_at, 'expires_at' => $this->expires_at, 'synced_at' => $this->synced_at, 'archived_at' => $this->archived_at, '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('product/property/workflow/' . $this->getRouteKey() . '/' . $name); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $workflow->form($transition); $arr[$key]['label'] = trans('product::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('product/property//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('product::property.actions.' . $name); } return $arr; } }