/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Comment::truncate();
     $faker = \Faker\Factory::create('zh_TW');
     foreach (range(1, 30) as $number) {
         Comment::create(['name' => $faker->name, 'email' => $faker->email, 'content' => $faker->paragraph, 'post_id' => rand(1, 15)]);
     }
 }
예제 #2
0
 public function run()
 {
     Comment::truncate();
     $faker = Faker\Factory::create();
     $userIds = User::lists('id');
     $postIds = Post::lists('id');
     for ($i = 0; $i < 10; $i++) {
         Comment::create(['desc' => $faker->sentence, 'user_id' => $faker->randomElement($userIds), 'post_id' => $faker->randomElement($postIds), 'status' => $faker->randomElement(array(0, 1))]);
     }
 }
예제 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Comment::truncate();
     factory(Comment::class, 0)->create();
 }