findByEmail( new EmailAddress(UserSeeder::EMAIL), ); if ($user === null) { throw new RuntimeException('seeded user not found'); } $repository = app(SetRepository::class); $existingNames = array_map(function ($set): string { return $set->getName(); }, $repository->all()); foreach (self::NAMES as $name) { if (in_array($name, $existingNames, true)) { continue; } $repository->create(new CreateSetDto( name: $name, creator: $user, )); } } }