public function toProductInfo(Request $request) { $id = $request->input('id', ''); $product = Product::find($id); $product->category = Category::find($product->category_id); $pdt_content = PdtContent::where('product_id', $id)->first(); $pdt_images = PdtImages::where('product_id', $id)->get(); return view('admin.product_info')->with('product', $product)->with('pdt_content', $pdt_content)->with('pdt_images', $pdt_images); }
public function categoryEdit(Request $request) { $id = $request->input('id', ''); $category = Category::find($id); $name = $request->input('name', ''); $category_no = $request->input('category_no', ''); $parent_id = $request->input('parent_id', ''); $preview = $request->input('preview', ''); $category->name = $name; $category->category_no = $category_no; if ($parent_id != '') { $category->parent_id = $parent_id; } $category->preview = $preview; $category->save(); $m3_result = new M3Result(); $m3_result->status = 0; $m3_result->message = '添加成功'; return $m3_result->toJson(); }