From c99d45b7b58fe352b574e0a508c160edece3c20d Mon Sep 17 00:00:00 2001 From: Zep Fietje Date: Wed, 22 Feb 2023 12:48:39 +0100 Subject: [PATCH] [10.x] Accept time when generating ULID (#46201) * Accept time when generating ULID * Always return Ulid object --- src/Illuminate/Support/Str.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 51b594a64af9..f60593d0ffb7 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -1375,11 +1375,16 @@ public static function createUuidsNormally() /** * Generate a ULID. * + * @param \DateTimeInterface|null $time * @return \Symfony\Component\Uid\Ulid */ - public static function ulid() + public static function ulid($time = null) { - return new Ulid(); + if ($time === null) { + return new Ulid(); + } + + return new Ulid(Ulid::generate($time)); } /**