/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $users = \Birdwatcher\User::all();
     foreach ($users as $name => $birds) {
         $user = \Birdwatcher\User::where('name', 'like', $name)->first();
         foreach ($birds as $birdName) {
             $bird = \Birdwatcher\Bird::where('name', 'LIKE', $birdName)->first();
             $user->birds()->save($bird);
         }
     }
 }
Пример #2
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }