mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 02:34:03 +00:00
* feat: introduce a simple ULID generator * add test --------- Co-authored-by: Samuel Štancl <samuel@archte.ch>
20 lines
435 B
PHP
20 lines
435 B
PHP
<?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();
|
|
}
|
|
}
|