database/seeders/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, 5))->make()
                )
        });
    }
public function run ( ) { factory ( App \ User :: class , 3 ) -> create ( ) . each ( function ( $ u ) { $ u -> questions ( ) -> saveMany ( factory ( App \ Question :: class , rand ( 1 , 5 ) ) -> make ( ) ) } ) ; }
Seed the application's database.
Seed the application ' s database .
// \App\Models\User::factory(10)->create();