1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 14:34:04 +00:00

[4.x] Add ULIDGenerator (#1332)

* feat: introduce a simple ULID generator

* add test

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
This commit is contained in:
Alexandru Bucur 2025-03-18 19:00:35 +01:00 committed by GitHub
parent 84a2863d2d
commit 8d87ee9dfc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 0 deletions

View 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 UUID for the tenant key.
*/
class ULIDGenerator implements UniqueIdentifierGenerator
{
public static function generate(Model $model): string|int
{
return Str::ulid()->toString();
}
}