/** * Run the database seeds. * * @return void */ public function run() { DB::table('brand_owners')->truncate(); $faker = Faker::create(); foreach (range(1, 20) as $index) { BrandOwner::create(['name' => $faker->company]); } }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('brands')->truncate(); $faker = Faker::create(); foreach (range(1, 20) as $index) { Brand::create(['name' => "Brand " . $index, 'brand_owner_id' => BrandOwner::find($faker->numberBetween(1, 20))->id, 'industry_id' => Industry::find($faker->numberBetween(1, 20))->id]); } }
/** * Show the form for editing the specified Brand. * * @param int $id * * @return Response */ public function edit($id) { $brand = $this->brandRepository->findWithoutFail($id); $brand_owners = BrandOwner::lists('name', 'id'); $industries = Industry::lists('name', 'id'); if (empty($brand)) { Flash::error('Brand not found'); return redirect(route('brands.index')); } return view('brands.edit')->with('brand', $brand)->with('brand_owners', $brand_owners)->with('industries', $industries); }