Files
freeu-project/app/Http/Controllers/Frontend/GlobalRealAssetController.php
cj201199 d096af9a9b solving
2024-05-15 11:50:32 +05:30

90 lines
3.1 KiB
PHP

<?php
namespace App\Http\Controllers\Frontend;
use App\Models\Product;
use App\Http\Controllers\Controller;
use App\Services\Frontend\GlobalRealEstateService;
use App\Http\Resources\FractionalRealEstate as test;
class GlobalRealAssetController extends Controller
{
protected $gre;
public function __construct(GlobalRealEstateService $gre)
{
$this->gre = $gre;
}
public function index()
{
return view('Frontend.Pages.global-real-estate.index');
}
public function industrial()
{
// dd($this->gre->openGIRE()->getData());
return view('Frontend.Pages.global-real-estate.industrial', [
'openGIRE' => $this->gre->openGIRE()->getData(),
'fullyFundedGIRE' => $this->gre->fullyFundedGIRE()->getData(),
'resaleGIRE' => $this->gre->resaleGIRE()->getData(),
'learnMore' => $this->gre->globalIndustrialRealEstateLearnMore()->getData()
]);
}
public function residential()
{
// dd($this->gre->openGRRE()->getData());
return view('Frontend.Pages.global-real-estate.residential', [
'openGRRE' => $this->gre->openGRRE()->getData(),
'fullyFundedGRRE' => $this->gre->fullyFundedGRRE()->getData(),
'resaleGRRE' => $this->gre->resaleGRRE()->getData(),
'learnMore' => $this->gre->globalResidentialRealEstateLearnMore()->getData()
]);
}
public function commercial()
{
// dd($this->gre->openGCRE()->getData());
return view('Frontend.Pages.global-real-estate.commercial', [
'openGCRE' => $this->gre->openGCRE()->getData(),
'fullyFundedGCRE' => $this->gre->fullyFundedGCRE()->getData(),
'resaleGCRE' => $this->gre->resaleGCRE()->getData(),
'learnMore' => $this->gre->globalCommercialRealEstateLearnMore()->getData()
]);
}
public function globalIndustrialRealEstateAllData($type = 'Open')
{
try {
return (new test(Product::has('realEstate')->with('realEstate.photo')->globalIndustrialRealEstate()->where('type', $type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function globalResidentialRealEstateAllData($type = 'Open')
{
try {
return (new test(Product::has('realEstate')->with('realEstate.photo')->globalResidentialRealEstate()->where('type', $type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function globalCommercialRealEstateAllData($type = 'Open')
{
try {
return (new test(Product::has('realEstate')->with('realEstate.photo')->globalCommercialRealEstate()->where('type', $type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
}