highYieldFinance()->getData(); $learnMore = (new FractionalRealEstateFrontendController)->highYieldFinanceQuestionAndAnswer()->getData(); $faqs = (new FractionalRealEstateFrontendController)->highYieldFinanceQuestionAndAnswerFaqs()->getData(); return view('Frontend.Pages.high-yield-finance.index', compact('highYieldFinance','learnMore','faqs')); } public function product($slug) { $highYieldFinance = $this->highYieldFinanceData($slug)->getData()->data; $otherHYF = HighYieldFinance::query() ->join('products', 'high_yield_finances.products_id', 'products.id') ->where('status',true) ->where('slug', '!=', $slug) ->where('categories_id',1) ->get(); // dd($otherHYF); $productData = HighYieldFinance::where('slug','=',$slug)->first(); $productData = Product::where('id','=',$productData->products_id)->first(); return view('Frontend.Pages.high-yield-finance.product', compact('highYieldFinance','otherHYF','productData')); } // public function highYieldFinance(){ // $highYieldFinance = Product::with('highYieldFinances', 'category')->highYieldFinances()->active()->get(); // return $highYieldFinance; // } public function highYieldFinance() { try { return (new test(Product::has('highYieldFinances')->with('highYieldFinances')->active()->get())) ->response() ->setStatusCode(200); } catch (\Exception $e) { return response()->json(['message' => $e->getMessage()], 400); } } public function highYieldFinanceData($slug) { try { return (new HighYieldFinanceResource(HighYieldFinance::where('slug', $slug)->first())) ->response() ->setStatusCode(200); } catch (\Exception $e) { return response()->json(['message' => $e->getMessage()], 400); } } }