You can specify dependencies in the run()
method of your seeder.
class DatabaseSeeder extends Seeder{ public function run() { $user = User::factory()->create(); $this->callWith(EventSeeder::class, [ 'user' => $user ]); }}
class EventSeeder extends Seeder{ public function run(User $user) { Event::factory() ->when($user, fn($f) => $f->for('user')) ->for(Program::factory()) ->create(); }}
Tip given by @justsanjit