database/seeds/PostsTableSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $users = \App\User::all();
        foreach ($users as $user){
            factory(Post::class, 5)->create([
                'user_id' => $user->id
            ]);
        }
    }
public function run ( ) { $ users = \ App \ User :: all ( ) ; foreach ( $ users as $ user ) { factory ( Post :: class , 5 ) -> create ( [ 'user_id' => $ user -> id ] ) ; } }
Run the database seeds.
Run the database seeds .