/** * Run the database seeds. * * @return void */ public function run() { DB::table('wineries')->truncate(); $faker = Faker\Factory::create(); for ($i = 1; $i <= 50; $i++) { $winery = new Winery(); $winery->name = ucwords(implode(' ', $faker->words(3))); $winery->address = $faker->address(); $winery->country_id = Country::whereCode($faker->countryCode())->first(); $winery->save(); } }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('users')->delete(); $users = [['id' => 1, 'name' => 'System', 'email' => 'system@vinfo', 'password' => bcrypt('password'), 'is_admin' => true], ['id' => 2, 'name' => 'Admin', 'email' => 'admin@vinfo', 'password' => bcrypt('password'), 'is_admin' => true], ['id' => 3, 'name' => 'User', 'email' => 'user@vinfo', 'password' => bcrypt('password'), 'is_admin' => false]]; $country = Country::whereCode('GB')->first(); $language = Language::whereCode('en-GB')->first(); $currency = Currency::whereCode('GBP')->first(); foreach ($users as $userData) { $user = new User(); $user->fill($userData); $user->country()->associate($country); $user->language()->associate($language); $user->currency()->associate($currency); $user->save(); } }