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, 'deal_ref' => $this->deal_ref, 'team_id' => $this->team_id, 'deal_id' => $this->deal_id, 'location' => $this->location, 'buyers' => $this->buyers, 'sellers' => $this->sellers, 'developer' => $this->developer, 'ref' => $this->ref, 'type' => $this->type, 'property_type' => $this->property_type, 'property_status' => $this->property_status, 'developer_id' => $this->developer_id, 'agent_id' => $this->agent_id, 'bua' => $this->bua, 'plot' => $this->plot, 'status' => $this->status, 'plot_area' => $this->plot_area, 'plot_area_unit' => $this->plot_area_unit, 'commission_buyer' => $this->commission_buyer, 'commission_buyer_percent' => $this->commission_buyer_percent, 'commission_buyer_vat' => $this->commission_buyer_vat, 'commission_seller' => $this->commission_seller, 'commission_seller_percent' => $this->commission_seller_percent, 'commission_seller_vat' => $this->commission_seller_vat, 'unit_no' => $this->unit_no, 'agency_commission_amt' => $this->agency_commission_amt, 'beds' => $this->beds, 'notes' => $this->notes, 'approved_id' => $this->approved_id, 'approved_date' => $this->approved_date, 'mou_start_date' => $this->mou_start_date, 'mou_end_date' => $this->mou_end_date, 'documents' => $this->documents, 'status_fcs' => $this->status_fcs, 'original_price' => $this->original_price, 'paid_amount' => $this->paid_amount, 'selling_price' => $this->selling_price, 'service_charge' => $this->service_charge, 'balance_amount' => $this->balance_amount, 'due_to_developer' => $this->due_to_developer, 'due_to_seller' => $this->due_to_seller, 'external_office_name' => $this->external_office_name, 'external_license' => $this->external_license, 'external_orn' => $this->external_orn, 'external_license_no' => $this->external_license_no, 'external_fax' => $this->external_fax, 'external_phone' => $this->external_phone, 'external_address' => $this->external_address, 'external_email' => $this->external_email, 'external_agent_name' => $this->external_agent_name, 'external_mobile' => $this->external_mobile, 'external_brn' => $this->external_brn, 'external_agency_rep' => $this->external_agency_rep, 'project_name' => $this->project_name, 'development' => $this->development, 'community' => $this->community, 'date_of_transfer' => $this->date_of_transfer, 'type_of_area' => $this->type_of_area, 'title_deed_no' => $this->title_deed_no, 'property_no' => $this->property_no, 'community_no' => $this->community_no, 'type_of_sale' => $this->type_of_sale, 'noc_developer' => $this->noc_developer, 'mortgage' => $this->mortgage, 'mortgage_amount' => $this->mortgage_amount, 'mortgage_paid_amount' => $this->mortgage_paid_amount, 'mortgage_period_from' => $this->mortgage_period_from, 'mortgage_period_to' => $this->mortgage_period_to, 'mortgage_level' => $this->mortgage_level, 'mortgage_discharge_fee' => $this->mortgage_discharge_fee, 'mortgage_registration_fee' => $this->mortgage_registration_fee, 'noc_attached' => $this->noc_attached, 'buyer_type' => $this->buyer_type, 'seller_type' => $this->seller_type, 'buyer_transfer_fee_per' => $this->buyer_transfer_fee_per, 'buyer_transfer_fee' => $this->buyer_transfer_fee, 'seller_transfer_fee_per' => $this->seller_transfer_fee_per, 'seller_transfer_fee' => $this->seller_transfer_fee, 'transfer_admin_fee' => $this->transfer_admin_fee, 'buyer_community_fees' => $this->buyer_community_fees, 'seller_community_fees' => $this->seller_community_fees, 'buyer_total_amount' => $this->buyer_total_amount, 'seller_total_amount' => $this->seller_total_amount, 'noc_fee' => $this->noc_fee, 'buyer_conveyance_fee' => $this->buyer_conveyance_fee, 'buyer_deposit_percent' => $this->buyer_deposit_percent, 'buyer_deposit' => $this->buyer_deposit, 'seller_conveyance_fee' => $this->seller_conveyance_fee, 'buyer_progression_fee' => $this->buyer_progression_fee, 'seller_progression_fee' => $this->seller_progression_fee, 'property_blocking_fee' => $this->property_blocking_fee, 'trustee_blocking_fee' => $this->trustee_blocking_fee, 'buyer_sell_price' => $this->buyer_sell_price, 'commission_agency' => $this->commission_agency, 'present_use' => $this->present_use, 'additional_info' => $this->additional_info, 'listed_price' => $this->listed_price, 'agent_brn' => $this->agent_brn, 'agent_mobile' => $this->agent_mobile, 'property_rented' => $this->property_rented, 'rent_amount' => $this->rent_amount, 'rent_security_deposit' => $this->rent_security_deposit, 'number_of_rented_properties' => $this->number_of_rented_properties, 'rent_expiry' => $this->rent_expiry, 'number_of_cheque' => $this->number_of_cheque, 'rent_refund' => $this->rent_refund, 'refund_to_buyer' => $this->refund_to_buyer, 'owner_name_english' => $this->owner_name_english, 'owner_name_arabic' => $this->owner_name_arabic, 'owner_LR_english' => $this->owner_LR_english, 'owner_LR_arabic' => $this->owner_LR_arabic, 'owner_representing_type' => $this->owner_representing_type, 'owner_attorney_no' => $this->owner_attorney_no, 'owner_card' => $this->owner_card, 'buyer_card' => $this->buyer_card, 'owner_power_attorney' => $this->owner_power_attorney, 'buyer_power_attorney' => $this->buyer_power_attorney, 'buyer_name_english' => $this->buyer_name_english, 'buyer_name_arabic' => $this->buyer_name_arabic, 'buyer_LR_english' => $this->buyer_LR_english, 'buyer_LR_arabic' => $this->buyer_LR_arabic, 'buyer_representing_type' => $this->buyer_representing_type, 'buyer_attorney_no' => $this->buyer_attorney_no, 'slug' => $this->slug, 'opportunity_id' => $this->opportunity_id, 'offer_id' => $this->offer_id, 'rent_start_date' => $this->rent_start_date, 'stage' => $this->stage, 'stages' => $this->stages, 'baths' => $this->baths, 'furnished' => $this->furnished, 'occupancy' => $this->occupancy, 'conveyencer' => $this->conveyencer, 'admin' => $this->admin, 'on_payment_plan' => $this->on_payment_plan, 'external_documents' => $this->external_documents, 'seller_agent_id' => $this->seller_agent_id, 'buyer_documents' => $this->buyer_documents, 'seller_documents' => $this->seller_documents, 'approved_loan_amount' => $this->approved_loan_amount, 'conveyancer' => $this->conveyancer, 'rejected_description' => $this->rejected_description, 'conveyancer_notes' => $this->conveyancer_notes, 'notifications' => $this->notifications, 'listing_id' => $this->listing_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('conveyancing/conveyancing/workflow/' . $this->getRouteKey() . '/' . $name); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $workflow->form($transition); $arr[$key]['label'] = trans('conveyancing::conveyancing.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('conveyancing/conveyancing//action' . $this->getRouteKey() . '/' . $action->name()); $arr[$key]['name'] = $name; $arr[$key]['key'] = $name; $arr[$key]['form'] = $action->form(); $arr[$key]['label'] = trans('conveyancing::conveyancing.actions.' . $name); } return $arr; } }