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, 'buyers' => $this->buyers, 'sellers' => $this->sellers, 'seller_source' => $this->seller_source, 'buyer_source' => $this->buyer_source, 'category_id' => $this->category_id, '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, 'ref' => $this->ref, 'type' => $this->type, 'property_type' => $this->property_type, 'developer_id' => $this->developer_id, 'bua' => $this->bua, 'plot' => $this->plot, 'status' => $this->status, 'price' => $this->price, 'baths' => $this->baths, 'plot_area' => $this->plot_area, 'frequency' => $this->frequency, 'furnished' => $this->furnished, 'cheques' => $this->cheques, 'instalments' => $this->instalments, 'maintenance_fee' => $this->maintenance_fee, 'next_available' => $this->next_available, 'rent_start_date' => $this->rent_start_date, 'rent_end_date' => $this->rent_end_date, 'rera' => $this->rera, 'payment_mode' => $this->payment_mode, 'deposit' => $this->deposit, 'deposit_percent' => $this->deposit_percent, 'deal_date' => $this->deal_date, 'unit_no' => $this->unit_no, 'beds' => $this->beds, 'street' => $this->street, 'floor' => $this->floor, 'property_usage' => $this->property_usage, 'notes' => $this->notes, 'notifications' => $this->notifications, 'approved_id' => $this->approved_id, 'approved_date' => $this->approved_date, 'rejected_id' => $this->rejected_id, 'rejected_description' => $this->rejected_description, 'aml_id' => $this->aml_id, 'aml_notes' => $this->aml_notes, 'aml_required' => $this->aml_required, 'aml_ids' => $this->aml_ids, 'aml_date' => $this->aml_date, 'aml_score' => $this->aml_score, 'from_pool' => $this->from_pool, 'client_id' => $this->client_id, '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('pep/pep/workflow/' . $this->getRouteKey() . '/' . $name); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $workflow->form($transition); $arr[$key]['label'] = trans('pep::pep.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('pep/pep//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('pep::pep.actions.' . $name); } return $arr; } }