Пример #1
0
 public function getCategoryByParentId($parent_id)
 {
     $categorys = Category::where('parent_id', $parent_id)->get();
     $m3_result = new M3Result();
     $m3_result->status = 0;
     $m3_result->message = '返回成功';
     $m3_result->categorys = $categorys;
     return $m3_result->toJson();
 }
 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();
 }
Пример #3
0
 public function toCategory($value = '')
 {
     Log::info("进入书籍类别");
     $categorys = Category::whereNull('parent_id')->get();
     return view('category')->with('categorys', $categorys);
 }
Пример #4
0
 public function toProductAdd()
 {
     $categories = Category::whereNotNull('parent_id')->get();
     return view('admin.product_add')->with('categories', $categories);
 }