Files
freeu-project/app/Http/Controllers/Frontend/IndianRealAssetController.php
2024-06-11 12:22:49 +05:30

107 lines
5.1 KiB
PHP

<?php
namespace App\Http\Controllers\Frontend;
use App\Models\Product;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Resources\FractionalRealEstate as test;
use App\Http\Resources\RealEstateResource;
use App\Models\RealEstate;
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
class IndianRealAssetController extends Controller
{
public function index()
{
return view('Frontend.Pages.indian-real-estate.index');
}
public function industrial()
{
$realEstate = $this->indianIndustrialRealEstateAllData()->getData();
$openIIRE = Product::has('realEstate')->with('realEstate','categorys')->indianIndustrialRealEstate()->open()->active()->get();
$resaleIIRE = Product::has('realEstate')->with('realEstate','categorys')->indianIndustrialRealEstate()->resale()->active()->get();
$fullyFundedIIRE = Product::has('realEstate')->with('realEstate','categorys')->indianIndustrialRealEstate()->fullyFunded()->active()->get();
$learnMore = (new FractionalRealEstateFrontendController)->indianIndustrialRealEstateQuestionAndAnswer()->getData();
// dd($realEstate);
return view('Frontend.Pages.indian-real-estate.industrial', compact('realEstate', 'learnMore', 'openIIRE', 'resaleIIRE', 'fullyFundedIIRE'));
}
public function residential()
{
$realEstate = $this->indianResidentialRealEstateAllData()->getData();
$openIRRE = Product::has('realEstate')->with('realEstate.companies','categorys')->indianResidentialRealEstate()->open()->active()->get();
$resaleIRRE = Product::has('realEstate')->with('realEstate','categorys')->indianResidentialRealEstate()->resale()->active()->get();
$fullyFundedIRRE = Product::has('realEstate')->with('realEstate','categorys')->indianResidentialRealEstate()->fullyFunded()->active()->get();
$learnMore = (new FractionalRealEstateFrontendController)->indianResidentialRealEstateQuestionAndAnswer()->getData();
// dd($openIRRE);
return view('Frontend.Pages.indian-real-estate.residential', compact('realEstate', 'learnMore', 'openIRRE', 'resaleIRRE', 'fullyFundedIRRE'));
}
public function commercial()
{
$realEstate = $this->indianCommercialRealEstateAllData()->getData();
$openICRE = Product::has('realEstate')->with('realEstate','categorys')->indianCommercialRealEstate()->open()->active()->get();
$resaleICRE = Product::has('realEstate')->with('realEstate','categorys')->indianCommercialRealEstate()->resale()->active()->get();
$fullyFundedICRE = Product::has('realEstate')->with('realEstate','categorys')->indianCommercialRealEstate()->fullyFunded()->active()->get();
$learnMore = (new FractionalRealEstateFrontendController)->indianCommercialRealEstateQuestionAndAnswer()->getData();
// dd($openICRE);
return view('Frontend.Pages.indian-real-estate.commercial', compact('realEstate', 'learnMore', 'openICRE', 'resaleICRE', 'fullyFundedICRE'));
}
public function product($slug)
{
$realEstate = RealEstate::with('realEstatePhoto')->where('slug', $slug)->first();
$productData = RealEstate::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($realEstate);
return view('Frontend.Pages.indian-real-estate.product', compact('realEstate', 'productData'));
}
public function indianIndustrialRealEstateAllData($type = 'Open')
{
try {
return (new test(Product::has('realEstate')->with('realEstate.photo')->indianIndustrialRealEstate()->where('type',$type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function indianResidentialRealEstateAllData($type = 'Open')
{
try {
return (new test(Product::has('realEstate')->with('realEstate.photo')->indianResidentialRealEstate()->where('type',$type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function indianCommercialRealEstateAllData($type = 'Open')
{
try {
return (new test(Product::has('realEstate')->with('realEstate.photo')->indianCommercialRealEstate()->where('type',$type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function realEstateData($slug)
{
try {
return (new RealEstateResource(RealEstate::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
}