Files
freeu-project/app/Http/Controllers/Frontend/GlobalExchangeTradedFundsController.php
Ritikesh yadav c661166e1d first commit
2024-03-28 14:52:40 +05:30

45 lines
2.1 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 GlobalExchangeTradedFundsController extends Controller
{
public function index(){
$etfs = $this->exchangeTradedFundsAllData()->getData();
$openGETF = Product::has('exchanges')->with('exchanges','categorys')->exchangeTradedFund()->open()->active()->latest()->get();
$resaleGETF = Product::has('exchanges')->with('exchanges','categorys')->exchangeTradedFund()->resale()->active()->latest()->get();
$fullyFundedGETF = Product::has('exchanges')->with('exchanges','categorys')->exchangeTradedFund()->fullyFunded()->active()->latest()->get();
$learnMore = (new FractionalRealEstateFrontendController)->exchangeTradedFundsQuestionAndAnswer()->getData();
// $faqs = (new FractionalRealEstateFrontendController)->exchangeTradedFundsQuestionAndAnswerFaqs()->getData();
// dd($openGETF);
return view('Frontend.Pages.etfs.index',compact('etfs','learnMore', 'openGETF', 'resaleGETF', 'fullyFundedGETF'));
}
public function product($slug = ''){
$etf = StockFundsRealEstateExchange::where('slug',$slug)->first();
$productData = StockFundsRealEstateExchange::where('slug','=',$slug)->first();
$productData = Product::where('id','=',$productData->products_id)->first();
// dd($etf);
return view('Frontend.Pages.etfs.product',compact('etf','productData'));
}
public function exchangeTradedFundsAllData($type = 'Open')
{
try {
return (new test(Product::has('exchanges')->with('exchanges')->exchangeTradedFund()->where('type',$type)->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
}