Example #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     $faker = Faker::create();
     $userIds = Cotr\User::lists('id')->all();
     for ($i = 0; $i < 30; $i++) {
         RpgSite::create(['name' => $faker->unique()->company, 'url' => $faker->unique()->url, 'image' => $faker->imageUrl, 'info' => $faker->realText(1000), 'proposed_by_user_id' => $faker->randomElement($userIds), 'approved_at' => $faker->optional(0.8)->datetime, 'announced_at' => $faker->date, 'launched_at' => $faker->optional(0.8)->date, 'closed_at' => $faker->optional(0.1)->date, 'created_at' => $faker->date, 'updated_at' => $faker->date, 'deleted_at' => $faker->optional(0.1)->date]);
     }
 }
Example #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     $userIds = Cotr\User::lists('id')->all();
     for ($i = 0; $i < 10; $i++) {
         $userId = $faker->optional(0.5)->randomElement($userIds);
         if ($userId !== null) {
             if (($key = array_search($userId, $userIds)) !== false) {
                 unset($userIds[$key]);
             }
         }
         BetaToken::create(['token' => str_random(5), 'user_id' => $userId]);
     }
 }