/** * Display a listing of the resource. * * @return Response */ public function index($id) { $product = new Product(); $product = Product::find($id); $categorys = new Category(); $categorys = Category::all(); $brands = new Brand(); $brands = Brand::all(); $reviews = new Review(); $reviews = $reviews = DB::table('review')->where('product_id', '=', $id)->get(); return view('productDetails.productDetails', ['product' => $product, 'categorys' => $categorys, 'brands' => $brands, 'reviews' => $reviews]); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $product = Product::find($id); return $product; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $music = new Product(); Product::find($id)->delete(); $musics = $music->join('categories', 'products.category_id', '=', 'categories.id')->select('products.title', 'products.description', 'products.price', 'products.id', 'categories.name')->get(); $music_style = new Musicstyle(); $music_styles = $music_style->orderBy('name')->get(); return view('products')->with('products', $musics)->with('categories', $music_styles)->with('deleted', 1); }
public function getProductDetail($product_id) { //preparing models for view $product = Product::find($product_id); return View::make('product_detail', compact('product')); }