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(), 'buyer_id' => $this->buyer_id, 'seller_id' => $this->seller_id, '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, 'bua' => $this->bua, 'plot' => $this->plot, 'status' => $this->status, 'status_aml' => $this->status_aml, '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, 'aml_id' => $this->aml_id, 'anl_notes' => $this->anl_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, '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(''), ], ]; } /** * 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(), ], ]; } private function workflows() { $arr = []; $workflow = $this->workflow(); foreach ($workflow->transitions($this) as $key => $transition) { $name = $transition->getName(); $arr[$key]['url'] = guard_url('aml/deal/workflow/' . $this->getRouteKey() . '/' . $name); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $workflow->form($transition); $arr[$key]['label'] = trans('aml::deal.workflow.' . $name); } return $arr; } private function actions() { $arr = []; $actions = $this->resource->actions()->details(); foreach ($actions as $key => $action) { $name = $action->name(); $arr[$key]['url'] = guard_url('aml/deal//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('aml::deal.actions.' . $name); } return $arr; } }