45 lines
2.0 KiB
PHP
45 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Frontend;
|
|
|
|
use App\Http\Resources\FractionalRealEstate as test;
|
|
use App\Models\Product;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\StockFundsRealEstateExchange;
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
|
|
|
class GlobalREITSController extends Controller
|
|
{
|
|
public function index(){
|
|
$reits = $this->reitsAllData()->getData();
|
|
$openREITS = Product::has('exchanges')->with('exchanges','categorys')->reits()->open()->active()->latest()->get();
|
|
$resaleREITS = Product::has('exchanges')->with('exchanges','categorys')->reits()->resale()->active()->latest()->get();
|
|
$fullyFundedREITS = Product::has('exchanges')->with('exchanges','categorys')->reits()->fullyFunded()->active()->latest()->get();
|
|
$learnMore = (new FractionalRealEstateFrontendController)->reitQuestionAndAnswer()->getData();
|
|
// $faqs = (new FractionalRealEstateFrontendController)->reitQuestionAndAnswerFaqs()->getData();
|
|
// dd($openREITS);
|
|
return view('Frontend.Pages.reits.index',compact('reits','learnMore', 'openREITS', 'resaleREITS', 'fullyFundedREITS'));
|
|
}
|
|
|
|
public function product($slug = ''){
|
|
$reit = StockFundsRealEstateExchange::where('slug',$slug)->first();
|
|
$productData = StockFundsRealEstateExchange::where('slug','=',$slug)->first();
|
|
$productData = Product::where('id','=',$productData->products_id)->first();
|
|
// dd($productData);
|
|
return view('Frontend.Pages.reits.product',compact('reit','productData'));
|
|
|
|
}
|
|
|
|
public function reitsAllData($type = 'Open')
|
|
{
|
|
try {
|
|
return (new test(Product::has('exchanges')->with('exchanges')->reits()->where('type',$type)->get()))
|
|
->response()
|
|
->setStatusCode(200);
|
|
} catch (\Exception $e) {
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
|
}
|
|
}
|
|
}
|