Files
freeu-project/app/Services/Frontend/GlobalRealEstateService.php

86 lines
3.0 KiB
PHP
Raw Normal View History

2024-03-28 14:52:40 +05:30
<?php
namespace App\Services\Frontend;
use App\Models\Product;
use App\Models\Admin\FAQ;
use App\Models\Admin\Tag;
use App\Traits\HttpResponse;
use App\Http\Resources\FractionalRealEstate as Resource;
class GlobalRealEstateService{
use HttpResponse;
public function openGIRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalIndustrialRealEstate()->open()->active()->get());
}
public function fullyFundedGIRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalIndustrialRealEstate()->open()->active()->get());
}
public function resaleGIRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalIndustrialRealEstate()->open()->active()->get());
}
public function openGCRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalCommercialRealEstate()->open()->active()->get());
}
public function fullyFundedGCRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalCommercialRealEstate()->open()->active()->get());
}
public function resaleGCRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalCommercialRealEstate()->open()->active()->get());
}
public function openGRRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalResidentialRealEstate()->open()->active()->get());
}
public function fullyFundedGRRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalResidentialRealEstate()->open()->active()->get());
}
public function resaleGRRE()
{
return $this->returnResponse(Product::has('realEstate')->with('realEstate','categorys')->globalResidentialRealEstate()->open()->active()->get());
}
public function globalCommercialRealEstateLearnMore(){
return $this->returnData(FAQ::where('tag_id', Tag::GlobalCommercialRealEstateID)->active()->get());
}
public function globalResidentialRealEstateLearnMore(){
return $this->returnData(FAQ::where('tag_id', Tag::GlobalResidentialRealEstateID)->active()->get());
}
public function globalIndustrialRealEstateLearnMore(){
return $this->returnData(FAQ::where('tag_id', Tag::GlobalIndustrialRealEstateID)->active()->get());
}
public function returnData($data)
{
return $data ? $this->apiResponse($data, 200) : $this->apiResponse($data, 400);
}
public function returnResponse($product)
{
try {
return (new Resource($product))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
}