From c49e9015774a76cdcff2900455b899a633d6769c Mon Sep 17 00:00:00 2001 From: Karem Sobhy Date: Thu, 18 Jul 2024 21:44:28 +0300 Subject: [PATCH] [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 --- .../Eloquent/Concerns/HasVersion7Uuids.php | 20 +++++++++++++++++++ src/Illuminate/Support/Str.php | 13 ++++++++++++ tests/Support/SupportStrTest.php | 3 ++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/Illuminate/Database/Eloquent/Concerns/HasVersion7Uuids.php diff --git a/src/Illuminate/Database/Eloquent/Concerns/HasVersion7Uuids.php b/src/Illuminate/Database/Eloquent/Concerns/HasVersion7Uuids.php new file mode 100644 index 000000000000..455bf74aa576 --- /dev/null +++ b/src/Illuminate/Database/Eloquent/Concerns/HasVersion7Uuids.php @@ -0,0 +1,20 @@ +assertInstanceOf(UuidInterface::class, Str::uuid()); $this->assertInstanceOf(UuidInterface::class, Str::orderedUuid()); + $this->assertInstanceOf(UuidInterface::class, Str::uuid7()); } public function testAsciiNull() @@ -1354,7 +1355,7 @@ public function testItCanSpecifyASequenceOfUuidsToUtilise() { Str::createUuidsUsingSequence([ 0 => ($zeroth = Str::uuid()), - 1 => ($first = Str::uuid()), + 1 => ($first = Str::uuid7()), // just generate a random one here... 3 => ($third = Str::uuid()), // continue to generate random uuids...