*/ class BrentPriceFactory extends Factory { /** @var array */ private static array $usedDates = []; public function definition(): array { do { $date = fake()->dateTimeBetween('-60 days')->format('Y-m-d'); } while (in_array($date, self::$usedDates, true)); self::$usedDates[] = $date; return [ 'date' => $date, 'price_usd' => fake()->randomFloat(2, 65, 95), ]; } }