Пример #1
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(App\Sub::class, 4)->create()->each(function ($sub) {
         $sub->owner()->associate(App\User::random()->first());
         $sub->save();
     });
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(App\Post::class, 100)->create()->each(function ($post) {
         $post->user()->associate(App\User::random()->first());
         $post->sub()->associate(App\Sub::random()->first());
         $post->save();
     });
 }
Пример #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     factory(App\Comment::class, 500)->create()->each(function ($comment) {
         $comment->user()->associate(App\User::random()->first());
         $comment->post()->associate(App\Post::random()->first());
         // TODO: Seed parent/child comment relationship
         $comment->save();
     });
 }