73 lines
3.3 KiB
PHP
73 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
use App\Models\Product;
|
|
use App\Resources\ProductPhotoResources;
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
class RealEstateResource extends JsonResource
|
|
{
|
|
/**
|
|
* Transform the resource into an array.
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable
|
|
*/
|
|
public function toArray($request)
|
|
{
|
|
return [
|
|
'id' => $this->id,
|
|
'products_id' => $this->products_id,
|
|
'presentation' => Product::find($this->products_id) ? Product::where('id',$this->products_id)->value('presentation') : null,
|
|
'fact_sheet' => Product::find($this->products_id) ? Product::where('id',$this->products_id)->value('fact_sheet') : null,
|
|
'property_name' => $this->property_name,
|
|
'slug' => $this->slug,
|
|
'property_location' => $this->property_location,
|
|
'project_type' => $this->project_type,
|
|
'current_status' => $this->current_status,
|
|
'price_per_sq_ft' => $this->price_per_sq_ft,
|
|
'booking_amount' => $this->booking_amount,
|
|
'price_range' => $this->price_range,
|
|
'total_price' => $this->total_price,
|
|
'transaction_type' => $this->transaction_type,
|
|
'project_code_or_rera_id' => $this->project_code_or_rera_id,
|
|
'built_up_area' => $this->built_up_area,
|
|
'carpet_area' => $this->carpet_area,
|
|
'area_in_sq_ft' => $this->area_in_sq_ft,
|
|
'construction_status' => $this->construction_status,
|
|
'launch_date' => $this->launch_date,
|
|
'completed_in' => $this->completed_in,
|
|
'total_units' => $this->total_units,
|
|
'unit_type' => $this->unit_type,
|
|
'no_of_bedrooms' => $this->no_of_bedrooms,
|
|
'no_of_restrooms' => $this->no_of_restrooms,
|
|
'no_of_floors' => $this->no_of_floors,
|
|
'furnished_status' => $this->furnished_status,
|
|
'commencement_certificate' => $this->commencement_certificate,
|
|
'occupancy_certificate' => $this->occupancy_certificate,
|
|
'total_towers' => $this->total_towers,
|
|
'builder_details' => $this->builder_details,
|
|
'landmarks' => $this->landmarks,
|
|
'amenities' => $this->amenities,
|
|
'elevators' => $this->elevators,
|
|
'car_parking' => $this->car_parking,
|
|
'electricity_status' => $this->electricity_status,
|
|
'fire_safety_measures' => $this->fire_safety_measures,
|
|
'water_facility' => $this->water_facility,
|
|
'price_negotiable' => $this->price_negotiable,
|
|
'maintenance_fees' => $this->maintenance_fees,
|
|
'nearest_railway_metro_station' => $this->nearest_railway_metro_station,
|
|
'pre_leased' => $this->pre_leased,
|
|
'tenant_details' => $this->tenant_details,
|
|
'facilities_features' => $this->facilities_features,
|
|
'construction_age' => $this->construction_age,
|
|
'location' => $this->location,
|
|
'country' => $this->country,
|
|
'remarks' => $this->remarks,
|
|
'photos' => ProductPhotoResource::collection($this->realEstatePhoto),
|
|
'documents' => ProductPhotoResource::collection($this->realEstateDocuments)
|
|
];
|
|
}
|
|
}
|