/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $this->Config(); try { $data = $this->Model->findOrFail($id); return $this->SetSuccessJsonResponseData($data); } catch (ModelNotFoundException $e) { return $this->SetErrorJsonResponseData($e); } }
public function getViewModels(Request $request, $id) { if ($request->input('subcategory-id') == '') { $products = DB::table('products')->where('model', $id)->orderBy('id', 'desc')->paginate(18); } else { $products = DB::table('products')->where('model', $id)->where('sub_category', $request->input('subcategory-id'))->orderBy('id', 'desc')->paginate(500); } $categories = ProductCategories::all(); $subcategories = SubProductCategories::all(); $currentPath = $request->url(); $models = Models::findOrFail($id); $productImages = DB::table('product_images')->get(); $count = 0; // making clearfix for latest products return view('pages.view-model')->with('products', $products)->with('categories', $categories)->with('subcategories', $subcategories)->with('currentPath', $currentPath)->with('models', $models)->with('productImages', $productImages)->with('count', $count); }