53 lines
1.9 KiB
PHP
53 lines
1.9 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\GlobalFundResource;
|
|
use App\Models\Fund;
|
|
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
|
|
|
class GlobalMutualFundController extends Controller
|
|
{
|
|
|
|
public function index(){
|
|
$mutualFund = $this->mutualFundAllData()->getData();
|
|
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
|
$faqs = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswerFaqs()->getData();
|
|
return view('Frontend.Pages.mutual-funds.index',compact('mutualFund','learnMore','faqs'));
|
|
}
|
|
|
|
public function product($slug = '')
|
|
{
|
|
$mutualFund = Fund::where('slug',$slug)->first();
|
|
$productData = Fund::where('slug','=',$slug)->first();
|
|
$productData = Product::where('id','=',$productData->products_id)->first();
|
|
return view('Frontend.Pages.mutual-funds.product',compact('mutualFund','productData'));
|
|
}
|
|
|
|
public function mutualFundAllData()
|
|
{
|
|
try {
|
|
return (new test(Product::has('funds')->with('funds')->funds()->mutualFund()->get()))
|
|
->response()
|
|
->setStatusCode(200);
|
|
} catch (\Exception $e) {
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
|
}
|
|
}
|
|
|
|
public function fundData($slug)
|
|
{
|
|
try {
|
|
return (new GlobalFundResource(Fund::where('slug', $slug)->first()))
|
|
->response()
|
|
->setStatusCode(200);
|
|
} catch (\Exception $e) {
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
|
}
|
|
}
|
|
}
|