In Laravel, database seeding is generally accomplished through Model factories. So you define a blueprint for your Model using Faker data, and say how many instances you ne
this worked for me in laravel v8
for ($i=0; $i<=2; $i++) { $user = \App\Models\User::factory(1)->create()->first(); $product = \App\Models\Product::factory(1)->create(['user_id' => $user->id])->first(); }