Skip to content

Commit c99d45b

Browse files
authored
[10.x] Accept time when generating ULID (#46201)
* Accept time when generating ULID * Always return Ulid object
1 parent 5f90b72 commit c99d45b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/Illuminate/Support/Str.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,11 +1375,16 @@ public static function createUuidsNormally()
13751375
/**
13761376
* Generate a ULID.
13771377
*
1378+
* @param \DateTimeInterface|null $time
13781379
* @return \Symfony\Component\Uid\Ulid
13791380
*/
1380-
public static function ulid()
1381+
public static function ulid($time = null)
13811382
{
1382-
return new Ulid();
1383+
if ($time === null) {
1384+
return new Ulid();
1385+
}
1386+
1387+
return new Ulid(Ulid::generate($time));
13831388
}
13841389

13851390
/**

0 commit comments

Comments
 (0)