91 lines
3.5 KiB
PHP
91 lines
3.5 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers\Frontend;
|
||
|
|
|
||
|
|
use App\Models\Product;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use App\Models\Bonds;
|
||
|
|
use App\Http\Controllers\Controller;
|
||
|
|
use App\Http\Resources\FractionalRealEstate as test;
|
||
|
|
use App\Http\Resources\GlobalBondResource;
|
||
|
|
use App\Http\Controllers\Admin\ManageFreeUInvestments\FractionalRealEstateController as FractionalRealEstateFrontendController;
|
||
|
|
|
||
|
|
class GlobalBondController extends Controller
|
||
|
|
{
|
||
|
|
public function index(){
|
||
|
|
$learnMore = (new FractionalRealEstateFrontendController)->internationalBondsQuestionAndAnswer()->getData();
|
||
|
|
$faqs = (new FractionalRealEstateFrontendController)->internationalBondsQuestionAndAnswerFaqs()->getData();
|
||
|
|
return view('Frontend.Pages.bonds.index',compact('learnMore','faqs'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sovereignGovernmentBonds(){
|
||
|
|
$bonds = $this->sovereignGovernmentBondsAllData()->getData();
|
||
|
|
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||
|
|
return view('Frontend.Pages.bonds.sovereign-bonds',compact('bonds','learnMore'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function investmentGradeBonds(){
|
||
|
|
$bonds = $this->investmentGradeBondsAllData()->getData();
|
||
|
|
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||
|
|
return view('Frontend.Pages.bonds.investment-bonds',compact('bonds','learnMore'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function highYieldBonds(){
|
||
|
|
$bonds = $this->highYieldBondsAllData()->getData();
|
||
|
|
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||
|
|
return view('Frontend.Pages.bonds.high-yield-bonds',compact('bonds','learnMore'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function product($slug){
|
||
|
|
$bond = Bonds::where('slug',$slug)->first();
|
||
|
|
$learnMore = (new FractionalRealEstateFrontendController)->mutualFundsQuestionAndAnswer()->getData();
|
||
|
|
$productData = Bonds::where('slug','=',$slug)->first();
|
||
|
|
$productData = Product::where('id','=',$productData->products_id)->first();
|
||
|
|
return view('Frontend.Pages.bonds.products',compact('bond','productData'));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sovereignGovernmentBondsAllData()
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
return (new test(Product::has('bonds')->with('bonds')->bonds()->sovereignGovernmentBond()->get()))
|
||
|
|
->response()
|
||
|
|
->setStatusCode(200);
|
||
|
|
} catch (\Exception $e) {
|
||
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function investmentGradeBondsAllData()
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
return (new test(Product::has('bonds')->with('bonds')->bonds()->investmentGradeBond()->get()))
|
||
|
|
->response()
|
||
|
|
->setStatusCode(200);
|
||
|
|
} catch (\Exception $e) {
|
||
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function highYieldBondsAllData()
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
return (new test(Product::has('bonds')->with('bonds')->bonds()->highYieldBond()->get()))
|
||
|
|
->response()
|
||
|
|
->setStatusCode(200);
|
||
|
|
} catch (\Exception $e) {
|
||
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function bondData($slug)
|
||
|
|
{
|
||
|
|
try {
|
||
|
|
return (new GlobalBondResource(Bonds::where('slug', $slug)->first()))
|
||
|
|
->response()
|
||
|
|
->setStatusCode(200);
|
||
|
|
} catch (\Exception $e) {
|
||
|
|
return response()->json(['message' => $e->getMessage()], 400);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|