public function edit($id) { $category = Category::find($id); $types = Type::with("attributes")->get(); $categories = $this->get_categories(); $category->filter_attr = Attribute::with('type.attributes')->whereIn('id', unserialize($category->filter_attr))->get(); return view('admin.category.edit', ['category' => $category, 'categories' => $categories, 'types' => $types]); }
public function search(Request $request, $type_id) { $types = Type::all(); $keyword = "%" . $request->keyword . "%"; // return $keyword; $attributes = Attribute::with('type')->where('name', 'like', $keyword)->paginate(config('wyshop.page_size')); // return $attributes; return view('admin.attribute.index', ['types' => $types, 'type_id' => $type_id, 'attributes' => $attributes]); }
public function index($type_id) { $types = Type::all(); $attributes = Attribute::with('type')->where('type_id', $type_id)->paginate(config('wyshop.page_size')); return view('admin.attribute.index', ['types' => $types, 'type_id' => $type_id, 'attributes' => $attributes]); }