invoiceDiscounting()->getData(); $learnMore = (new FractionalRealEstateFrontendController)->invoiceDiscountingQuestionAndAnswer()->getData(); $faqs = (new FractionalRealEstateFrontendController)->invoiceDiscountingQuestionAndAnswerFaqs()->getData(); return view('Frontend.Pages.invoice-discounting.index',compact('invoiceDiscounting','learnMore','faqs')); } public function product($slug){ // $invoiceDiscounting = InvoiceDiscounting::where('slug',$slug)->first(); $invoiceDiscounting = $this->invoiceDiscountingData($slug)->getData()->data; $otherID = InvoiceDiscounting::query() ->join('products', 'invoice_discountings.products_id', 'products.id') ->where(['status' => true, 'categories_id' => 27]) // ->where('status',false) ->where('slug', '!=', $slug) // ->where('categories_id',26) ->get(); $productData = InvoiceDiscounting::where('slug','=',$slug)->first(); $productData = Product::where('id','=',$productData->products_id)->first(); $productData['presentation_file'] = $productData->getRawOriginal('presentation'); $productData['fact_sheet_file'] = $productData->getRawOriginal('fact_sheet'); // dd($productData); return view('Frontend.Pages.invoice-discounting.product',compact('invoiceDiscounting','otherID','productData')); } // public function invoiceDiscounting(){ // $invoiceDiscounting = Product::with('invoiceDiscounting', 'category')->invoiceDiscounting()->active()->get(); // return (object)[ // 'status' => 200, // 'data' => $invoiceDiscounting // ]; // // return $invoiceDiscounting; // } public function invoiceDiscounting() { try { return (new test(Product::has('invoiceDiscounting')->with('invoiceDiscounting')->active()->get())) ->response() ->setStatusCode(200); } catch (\Exception $e) { return response()->json(['message' => $e->getMessage()], 400); } } public function invoiceDiscountingData($slug) { try { return (new InvoiceDiscountingResource(InvoiceDiscounting::where('slug',$slug)->first())) ->response() ->setStatusCode(200); } catch (\Exception $e) { return response()->json(['message' => $e->getMessage()], 400); } } }