Skip to content

Commit

Permalink
[10.x] Accept time when generating ULID (#46201)
Browse files Browse the repository at this point in the history
* Accept time when generating ULID

* Always return Ulid object
  • Loading branch information
zepfietje authored Feb 22, 2023
1 parent 5f90b72 commit c99d45b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/**
Expand Down

0 comments on commit c99d45b

Please sign in to comment.