public function run() { DB::table('categories')->truncate(); $faker = Faker::create(); foreach (range(1, 15) as $i) { Category::create(['name' => $faker->word, 'description' => $faker->sentence(10)]); } }
public function edit($id, Category $category) { $product = $this->productModel->findOrNew($id); $categories = $category->lists('name', 'id'); return view('admin.products.edit', compact('product', 'categories')); }