/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $category = Category::findorfail($id); $categories = Category::lists('name', 'id'); //$entity = Entity::Category()->get()->first(); return view('admin.category.edit')->with('categories', $categories)->with('category', $category); //->with('entity', $entity); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { //$entity = Entity::Product()->get()->first(); $product = Product::findorfail($id); $productCategory = $product->category()->lists('category_id')->toArray(); $price = $product->price()->get()->first(); $productPrice = isset($price) ? $price->sale_price : 0; $categories = Category::lists('name', 'id'); return view('admin.product.edit')->with('product', $product)->with('categories', $categories)->with('productCategory', $productCategory)->with('productPrice', $productPrice); }