Ejemplo n.º 1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $users = User::all();
     foreach ($users as $user) {
         $number = mt_rand(0, 15);
         for ($i = 0; $i < $number; $i++) {
             Album::create(['title' => "Title album {$i} of {$user->id}", 'description' => "Description album {$i} of {$user->id}", 'user_id' => $user->id]);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     Model::unguard();
     User::truncate();
     Album::truncate();
     // $this->call(UserTableSeeder::class);
     $this->call('UserTableSeeder');
     $this->call('AlbumTableSeeder');
     Model::reguard();
 }
Ejemplo n.º 3
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' => $data['password'], 'question' => $data['question'], 'answer' => bcrypt($data['answer'])]);
 }
Ejemplo n.º 4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     for ($i = 0; $i < 50; $i++) {
         User::create(['name' => "User {$i}", 'email' => "user{$i}@users.com", 'password' => bcrypt('pass'), 'question' => 'quest', 'answer' => bcrypt('ans')]);
     }
 }