Files
freeu-project/app/Http/Controllers/Frontend/AlternativeInvestmentFundController.php
meghamalore 2fde378902 fixing bugs
2024-05-10 11:09:28 +05:30

615 lines
26 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\DebtFundResource;
use App\Http\Resources\AngelFundResource;
use App\Http\Resources\HedgeFundResource;
use App\Http\Resources\LongOnlyEquityResource;
use App\Models\AlternativeInvestmentFund;
use App\Http\Resources\PrivateEquityFundResource;
use App\Http\Resources\PrivateCreditFundResource;
use App\Http\Resources\InfrastructureFundResource;
use App\Http\Resources\VentureCapitalFundResource;
use App\Http\Resources\FractionalRealEstate as test;
use App\Http\Resources\PrivateRealEstateFundResource;
use App\Http\Resources\FundForDistressedAssetResource;
use App\Http\Resources\PrivateInvestmentInPublicEquityFundResource;
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
use App\Services\Frontend\AIFService;
class AlternativeInvestmentFundController extends Controller
{
protected $aif;
public function __construct(AIFService $aif)
{
$this->aif = $aif;
}
public function index()
{
$learnMore = (new FractionalRealEstateFrontendController)->aifQuestionAndAnswer()->getData();
$faqs = (new FractionalRealEstateFrontendController)->aifQuestionAndAnswerFaqs()->getData();
return view('Frontend.Pages.alternative-investment-fund.index', compact('learnMore', 'faqs'));
}
public function aifCategoryOne()
{
$learnMore = (new FractionalRealEstateFrontendController)->aifIQuestionAndAnswer()->getData();
$faqs = (new FractionalRealEstateFrontendController)->aifIQuestionAndAnswerFaqs()->getData();
return view('Frontend.Pages.alternative-investment-fund.aif-category-one', compact('learnMore', 'faqs'));
}
public function aifCategoryTwo()
{
$learnMore = (new FractionalRealEstateFrontendController)->aifIIQuestionAndAnswer()->getData();
$faqs = (new FractionalRealEstateFrontendController)->aifIIQuestionAndAnswerFaqs()->getData();
return view('Frontend.Pages.alternative-investment-fund.aif-category-two', compact('learnMore', 'faqs'));
}
public function aifCategoryThree()
{
$learnMore = (new FractionalRealEstateFrontendController)->aifIIIQuestionAndAnswer()->getData();
$faqs = (new FractionalRealEstateFrontendController)->aifIIIQuestionAndAnswerFaqs()->getData();
return view('Frontend.Pages.alternative-investment-fund.aif-category-three', compact('learnMore', 'faqs'));
}
public function ventureCapitalFund()
{
return view('Frontend.Pages.alternative-investment-fund.venture-capital-fund', [
'openVCF' => $this->aif->openVCF()->getData(),
'fullyFundedVCF' => $this->aif->fullyFundedVCF()->getData(),
'resaleVCF' => $this->aif->resaleVCF()->getData(),
'learnMore' => $this->aif->ventureCapitalLearnMore()->getData()
]);
}
public function infrastructureFund()
{
return view('Frontend.Pages.alternative-investment-fund.infrastructure-fund', [
'openIF' => $this->aif->openIF()->getData(),
'fullyFundedIF' => $this->aif->fullyFundedIF()->getData(),
'resaleIF' => $this->aif->resaleIF()->getData(),
'learnMore' => $this->aif->infrastructureFundLearnMore()->getData()
]);
}
public function angelFund()
{
// dd($this->aif->openAF()->getData());
return view('Frontend.Pages.alternative-investment-fund.angel-fund', [
'openAF' => $this->aif->openAF()->getData(),
// 'fullyFundedAF' => $this->aif->fullyFundedAF()->getData(),
'resaleAF' => $this->aif->resaleAF()->getData(),
'learnMore' => $this->aif->angelFundLearnMore()->getData()
]);
}
public function privateEquityFund()
{
// dd($this->aif->openPEF()->getData());
return view('Frontend.Pages.alternative-investment-fund.private-equity-fund', [
'openPEF' => $this->aif->openPEF()->getData(),
'fullyFundedPEF' => $this->aif->fullyFundedPEF()->getData(),
'resalePEF' => $this->aif->resalePEF()->getData(),
'learnMore' => $this->aif->privateEquityFundLearnMore()->getData()
]);
}
// public function debtFund()
// {
// // $debtFund = $this->debtFundAllData()->getData()->data;
// // return view('Frontend.Pages.alternative-investment-fund.debt-fund', compact('debtFund'));
// return view('Frontend.Pages.alternative-investment-fund.debt-fund', [
// 'openDF' => $this->aif->openDF()->getData(),
// 'fullyFundedDF' => $this->aif->fullyFundedDF()->getData(),
// 'resaleDF' => $this->aif->resaleDF()->getData(),
// 'learnMore' => $this->aif->debtFundLearnMore()->getData()
// ]);
// }
public function privateRealEstateFund()
{
// dd($this->aif->openPREF()->getData());
return view('Frontend.Pages.alternative-investment-fund.private-real-estate-fund', [
'openPREF' => $this->aif->openPREF()->getData(),
'fullyFundedPREF' => $this->aif->fullyFundedPREF()->getData(),
'resalePREF' => $this->aif->resalePREF()->getData(),
'learnMore' => $this->aif->privateRealEstateFundLearnMore()->getData()
]);
}
public function fundForDistressedAsset()
{
// dd($this->aif->openFFDA()->getData());
return view('Frontend.Pages.alternative-investment-fund.fund-for-distressed-asset', [
'openFFDA' => $this->aif->openFFDA()->getData(),
'fullyFundedFFDA' => $this->aif->fullyFundedFFDA()->getData(),
'resaleFFDA' => $this->aif->resaleFFDA()->getData(),
'learnMore' => $this->aif->fundForDistressedAssetLearnMore()->getData()
]);
}
public function hedgeFund()
{
return view('Frontend.Pages.alternative-investment-fund.hedge-fund', [
'openHF' => $this->aif->openHF()->getData(),
'fullyFundedHF' => $this->aif->fullyFundedHF()->getData(),
'resaleHF' => $this->aif->resaleHF()->getData(),
'learnMore' => $this->aif->hedgeFundLearnMore()->getData()
]);
}
public function privateInvestmentPublicEquity()
{
return view('Frontend.Pages.alternative-investment-fund.private-investment-public-equity', [
'openPIPE' => $this->aif->openPIPE()->getData(),
'fullyFundedPIPE' => $this->aif->fullyFundedPIPE()->getData(),
'resalePIPE' => $this->aif->resalePIPE()->getData(),
'learnMore' => $this->aif->pipeLearnMore()->getData()
]);
}
public function ventureCapitalFundProduct($slug)
{
$ventureCapitalFund = $this->ventureCapitalData($slug)->getData()->data;
// dd($ventureCapitalFund);
$otherVCP = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->where(['status' => true, 'categories_id' => 28])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug',$slug)->first();
// dd($productData,$slug,$ventureCapitalFund);
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
return view('Frontend.Pages.alternative-investment-fund.venture-capital-fund-product', compact('ventureCapitalFund', 'otherVCP', 'productData'));
}
public function infrastructureFundProduct($slug)
{
$infrastructureFund = $this->infrastructureData($slug)->getData()->data;
$otherIF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->where(['status' => true, 'categories_id' => 29])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($infrastructureFund);
return view('Frontend.Pages.alternative-investment-fund.infrastructure-fund-product', compact('infrastructureFund', 'otherIF', 'productData'));
}
public function angelFundProduct($slug)
{
$angelFund = $this->ventureCapitalData($slug)->getData()->data;
$otherAF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->where(['status' => true, 'categories_id' => 30])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($angelFund);
return view('Frontend.Pages.alternative-investment-fund.angel-fund-product', compact('angelFund', 'otherAF', 'productData'));
}
public function privateEquityFundProduct($slug)
{
$privateEquityFund = $this->privateEquityData($slug)->getData()->data;
$otherPEF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
->where(['products.status' => true, 'categories_id' => 31])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($privateEquityFund);
return view('Frontend.Pages.alternative-investment-fund.private-equity-fund-product', compact('privateEquityFund', 'otherPEF', 'productData'));
}
public function debtFundProduct($slug)
{
$debtFund = $this->debtFundData($slug)->getData()->data;
$otherDF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
->where(['products.status' => true, 'categories_id' => 32])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
return view('Frontend.Pages.alternative-investment-fund.debt-fund-product', compact('debtFund', 'otherDF', 'productData'));
}
public function fundForDistressedAssetProduct($slug)
{
$fundForDistressedAsset = $this->fundForDistressedAssetData($slug)->getData()->data;
$otherFFDA = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
->where(['products.status' => true, 'categories_id' => 38])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($fundForDistressedAsset);
return view('Frontend.Pages.alternative-investment-fund.fund-for-distressed-asset-product', compact('fundForDistressedAsset', 'otherFFDA', 'productData'));
}
public function privateRealEstateFundProduct($slug)
{
$realEstate = $this->privateRealEstateFundData($slug)->getData()->data;
$otherPREF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
->where(['products.status' => true, 'categories_id' => 33])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($realEstate);
return view('Frontend.Pages.alternative-investment-fund.private-real-estate-fund-product', compact('realEstate', 'otherPREF', 'productData'));
}
public function hedgeFundProduct($slug)
{
$hedgeFund = $this->hedgeFundData($slug)->getData()->data;
$otherHF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->where(['status' => true, 'categories_id' => 34])
// ->where('status',false)
->where('slug', '!=', $slug)
// ->where('categories_id',26)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($productData);
// dd($hedgeFund);
return view('Frontend.Pages.alternative-investment-fund.hedge-fund-product', compact('hedgeFund', 'otherHF', 'productData'));
}
public function privateInvestmentPublicEquityProduct($slug)
{
$pipe = $this->pipeData($slug)->getData()->data;
// return $pipe;
$otherPIPE = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->where(['status' => true, 'categories_id' => 35])
// ->where('status',false)
->where('slug', '!=', $slug)
// ->where('categories_id',26)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($pipe);
return view('Frontend.Pages.alternative-investment-fund.private-investment-public-equity-product', compact('pipe', 'otherPIPE', 'productData'));
}
// public function ventureCapital(){
// $ventureCapital = Product::with('alternativeInvestmentFund', 'category')->ventureCapitalFund()->active()->get();
// return $ventureCapital;
// }
public function ventureCapital($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->ventureCapitalFund()->where('type', $type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function ventureCapitalData($slug)
{
try {
return (new VentureCapitalFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function infrastructure($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->infrastructureFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function infrastructureData($slug)
{
try {
return (new InfrastructureFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function angelFundAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->angelFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function angelFundData($slug)
{
try {
return (new AngelFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateEquityAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->privateEquityFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateEquityData($slug)
{
try {
return (new PrivateEquityFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function debtFundAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->debtFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function debtFundData($slug)
{
try {
return (new DebtFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateRealEstateFundAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->privateRealEstateFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateRealEstateFundData($slug)
{
try {
return (new PrivateRealEstateFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function fundForDistressedAssetAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->fundForDistressedAsset()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function fundForDistressedAssetData($slug)
{
try {
return (new FundForDistressedAssetResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function hedgeFundAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->where('type',$type)->hedgeFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function hedgeFundData($slug)
{
try {
return (new HedgeFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function longOnlyEquityFundAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies','product_images')->where('type',$type)->longOnlyEquityFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function longOnlyEquityFundData($slug)
{
try {
return (new LongOnlyEquityResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateCreditFundAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies','product_images')->where('type',$type)->privateCreditFund()->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateCreditFundData($slug)
{
try {
return (new LongOnlyEquityResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function pipeAllData($type = 'Open')
{
try {
return (new test(Product::has('alternativeInvestmentFund')->with('alternativeInvestmentFund.companies')->pipe()->where('type', $type)->active()->get()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function pipeData($slug)
{
try {
return (new PrivateInvestmentInPublicEquityFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function longOnlyEquityFund()
{
$learnMore = (new FractionalRealEstateFrontendController)->loefQuestionAndAnswer()->getData();
// 'openHF' => $this->aif->openHF()->getData(),
// 'fullyFundedHF' => $this->aif->fullyFundedHF()->getData(),
// 'resaleHF' => $this->aif->resaleHF()->getData(),
// 'learnMore' => $this->aif->hedgeFundLearnMore()->getData()
return view('Frontend.Pages.long-only-equity-fund.index', [
'learnMore' => $learnMore,
'openHF' => $this->aif->openLOE()->getData(),
// 'fullyFundedHF' => $this->aif->fullyFundedLOE()->getData(),
'resaleHF' => $this->aif->resaleLOE()->getData(),
]);
}
// long only equity fund Product
public function longOnlyEquityFundProduct($slug)
{
$longOnlyEquityFund = $this->longOnlyEquityFundData($slug)->getData()->data;
$otherHF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->where(['status' => true, 'categories_id' => 40])
// ->where('status',false)
->where('slug', '!=', $slug)
// ->where('categories_id',26)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($productData);
// dd($longOnlyEquityFund, $slug);
return view('Frontend.Pages.alternative-investment-fund.long-only-equity-fund-product', compact('longOnlyEquityFund', 'otherHF', 'productData'));
}
public function privateCreditFund()
{
$learnMore = (new FractionalRealEstateFrontendController)->pcfQuestionAndAnswer()->getData();
return view('Frontend.Pages.private-credit-fund.index', [
'learnMore' => $learnMore,
'openPCF' => $this->aif->openPCF()->getData(),
'resalePCF' => $this->aif->resalePCF()->getData(),
]);
}
public function privateCreditFundProductData($slug)
{
try {
return (new PrivateCreditFundResource(AlternativeInvestmentFund::where('slug', $slug)->first()))
->response()
->setStatusCode(200);
} catch (\Exception $e) {
return response()->json(['message' => $e->getMessage()], 400);
}
}
public function privateCreditFundProduct($slug)
{
$privateCreditFund = $this->privateCreditFundProductData($slug)->getData()->data;
$otherPEF = AlternativeInvestmentFund::query()
->join('products', 'alternative_investment_funds.products_id', 'products.id')
->join('companies', 'alternative_investment_funds.companies_id', 'companies.id')
->where(['products.status' => true, 'categories_id' => 31])
->where('slug', '!=', $slug)
->get();
$productData = AlternativeInvestmentFund::where('slug', '=', $slug)->first();
$productData = Product::with('product_images')->where('id', '=', $productData->products_id)->first();
// dd($privateCreditFund);
return view('Frontend.Pages.alternative-investment-fund.private-credit-fund-product', compact('privateCreditFund', 'otherPEF', 'productData'));
}
}