/** * Field list * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Request $request) { $fields = null; $categoryId = null; $categories = Category::lists('name', 'id')->toArray(); if ($request->has('category_id')) { $fields = Field::where('category_id', $request->get('category_id'))->where('option_id', null)->get(); $categoryId = $request->get('category_id'); } return view('backend.shop.field.index', compact('fields', 'categories', 'categoryId')); }
/** * Product create form page * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create() { $fields = Field::lists('name', 'id')->toArray(); $categories = ['' => 'Выберите категорию'] + Category::lists('name', 'id')->toArray(); return view('backend.shop.product.create', compact('categories', 'fields')); }
/** * Category create form * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function create() { $fields = Field::lists('name', 'id')->toArray(); $categories = ['' => 'Родительская категория'] + Category::lists('name', 'id')->toArray(); return view('backend.shop.category.create', compact('categories', 'fields')); }