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, 'transaction_id' => $this->transaction_id, 'procedure_id' => $this->procedure_id, 'trans_group_id' => $this->trans_group_id, 'trans_group_ar' => $this->trans_group_ar, 'trans_group_en' => $this->trans_group_en, 'procedure_name_ar' => $this->procedure_name_ar, 'procedure_name_en' => $this->procedure_name_en, 'instance_date' => $this->instance_date, 'property_type_id' => $this->property_type_id, 'property_type_ar' => $this->property_type_ar, 'property_type_en' => $this->property_type_en, 'property_sub_type_id' => $this->property_sub_type_id, 'property_sub_type_ar' => $this->property_sub_type_ar, 'property_sub_type_en' => $this->property_sub_type_en, 'property_usage_ar' => $this->property_usage_ar, 'property_usage_en' => $this->property_usage_en, 'reg_type_id' => $this->reg_type_id, 'reg_type_ar' => $this->reg_type_ar, 'reg_type_en' => $this->reg_type_en, 'area_id' => $this->area_id, 'area_name_ar' => $this->area_name_ar, 'area_name_en' => $this->area_name_en, 'building_name_ar' => $this->building_name_ar, 'building_name_en' => $this->building_name_en, 'project_number' => $this->project_number, 'project_name_ar' => $this->project_name_ar, 'project_name_en' => $this->project_name_en, 'master_project_en' => $this->master_project_en, 'master_project_ar' => $this->master_project_ar, 'nearest_landmark_ar' => $this->nearest_landmark_ar, 'nearest_landmark_en' => $this->nearest_landmark_en, 'nearest_metro_ar' => $this->nearest_metro_ar, 'nearest_metro_en' => $this->nearest_metro_en, 'nearest_mall_ar' => $this->nearest_mall_ar, 'nearest_mall_en' => $this->nearest_mall_en, 'rooms_ar' => $this->rooms_ar, 'rooms_en' => $this->rooms_en, 'has_parking' => $this->has_parking, 'procedure_area' => $this->procedure_area, 'actual_worth' => $this->actual_worth, 'meter_sale_price' => $this->meter_sale_price, 'rent_value' => $this->rent_value, 'meter_rent_price' => $this->meter_rent_price, 'no_of_parties_role_1' => $this->no_of_parties_role_1, 'no_of_parties_role_2' => $this->no_of_parties_role_2, 'no_of_parties_role_3' => $this->no_of_parties_role_3, '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('map/transaction/workflow/' . $this->getRouteKey() . '/' . $name); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $workflow->form($transition); $arr[$key]['label'] = trans('map::transaction.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('map/transaction//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('map::transaction.actions.' . $name); } return $arr; } }