mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 12:44:02 +00:00
Add UUIDv7Generator
Also correct docblock for ULIDGenerator and add missing @see annotations in the config file.
This commit is contained in:
parent
36153a949b
commit
b967d1647a
5 changed files with 39 additions and 2 deletions
|
|
@ -9,7 +9,7 @@ use Illuminate\Support\Str;
|
|||
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||
|
||||
/**
|
||||
* Generates a UUID for the tenant key.
|
||||
* Generates a ULID for the tenant key.
|
||||
*/
|
||||
class ULIDGenerator implements UniqueIdentifierGenerator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use Ramsey\Uuid\Uuid;
|
|||
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||
|
||||
/**
|
||||
* Generates a UUID for the tenant key.
|
||||
* Generates a UUIDv4 for the tenant key.
|
||||
*/
|
||||
class UUIDGenerator implements UniqueIdentifierGenerator
|
||||
{
|
||||
|
|
|
|||
20
src/UniqueIdentifierGenerators/UUIDv7Generator.php
Normal file
20
src/UniqueIdentifierGenerators/UUIDv7Generator.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Stancl\Tenancy\UniqueIdentifierGenerators;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||
|
||||
/**
|
||||
* Generates a UUIDv7 for the tenant key.
|
||||
*/
|
||||
class UUIDv7Generator implements UniqueIdentifierGenerator
|
||||
{
|
||||
public static function generate(Model $model): string|int
|
||||
{
|
||||
return Str::uuid7()->toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue