Files
freeu-project/app/Http/Controllers/GlobalPrivateCreditController.php
2024-06-17 19:24:17 +05:30

45 lines
2.2 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
use App\Models\Product;
use App\Models\Fund;
use App\Http\Resources\FractionalRealEstate as test;
class GlobalPrivateCreditController extends Controller
{
public function getGlobalPrivateCreditFundPage()
{
// dd(Product::has('funds')->with('funds')->funds()->globalPrivateCreditFund()->open()->active()->latest()->get());
$learnMore = (new FractionalRealEstateFrontendController)->globalPCFQuestionAndAnswer()->getData();
return view('Frontend.Pages.dummy.global-private-credit', [
'learnMore' => $learnMore,
'openGPCF' => Product::has('funds')->with('funds.companies','categorys')->funds()->globalPrivateCreditFund()->open()->active()->latest()->get(),
// 'resaleGPCF' => Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies', 'categorys')->globalPrivateCreditFund()->resale()->active()->latest()->get(),
'resaleGPCF' => Product::has('funds')->with('funds.companies','categorys')->funds()->globalPrivateCreditFund()->fullyFunded()->active()->latest()->get(),
]);
}
public function getGlobalPrivateCreditFundProduct($slug)
{
$ventureCapitalFund = Fund::with('returns')->where('slug', $slug)->first();
$productData = Fund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($ventureCapitalFund);
return view('Frontend.Pages.venture-capital-funds.product', compact('ventureCapitalFund', 'productData'));
}
public function privateCreditAllData($type = 'Open')
{
try {
return (new test(Product::has('funds')->with('funds.companies','product_images')->where('type', $type)->funds()->globalPrivateCreditFunds()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
}