database/seeds/DatabaseSeeder.php
/**
     * Seed the application's database.
     *
     * @return void
     */
Seed the application's database.
@return void
Seed the application ' s database . @return void
public function run()
    {
        factory(App\User::class, 3)->create()->each(function($u){
            $u->questions()->saveMany(
        factory(App\Question::class, rand(1, 7))->make()            
         )->each(function($q){
             $q->answers()->saveMany(
              factory(App\Answer::class, rand(1, 7))->make()         
            );
         });
        });
    }
public function run ( ) { factory ( App \ User :: class , 3 ) -> create ( ) -> each ( function ( $ u ) { $ u -> questions ( ) -> saveMany ( factory ( App \ Question :: class , rand ( 1 , 7 ) ) -> make ( ) ) -> each ( function ( $ q ) { $ q -> answers ( ) -> saveMany ( factory ( App \ Answer :: class , rand ( 1 , 7 ) ) -> make ( ) ) ; } ) ; } ) ; }
Seed the application's database.
Seed the application ' s database .