-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Implement HasV7Uuids to use with MariaDB native uuid data type (…
…#52029) * implement HasV7UUids * Implement all uuid4 methods to uuid7 for unified experience and add ability to define time for the uuid7 * formatting * formatting * remove property --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
- Loading branch information
1 parent
95107a0
commit c49e901
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/Illuminate/Database/Eloquent/Concerns/HasVersion7Uuids.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Illuminate\Database\Eloquent\Concerns; | ||
|
||
use Illuminate\Support\Str; | ||
|
||
trait HasVersion7Uuids | ||
{ | ||
use HasUuids; | ||
|
||
/** | ||
* Generate a new UUID (version 7) for the model. | ||
* | ||
* @return string | ||
*/ | ||
public function newUniqueId() | ||
{ | ||
return (string) Str::uuid7(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters