mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 12:04:03 +00:00
make int ranges configurable
This commit is contained in:
parent
4ddc2be569
commit
8f7b8e971a
1 changed files with 4 additions and 3 deletions
|
|
@ -9,13 +9,14 @@ use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a cryptographically secure random integer for the tenant key.
|
* Generates a cryptographically secure random integer for the tenant key.
|
||||||
*
|
|
||||||
* The integer is generated in range (0, PHP_INT_MAX).
|
|
||||||
*/
|
*/
|
||||||
class RandomIntGenerator implements UniqueIdentifierGenerator
|
class RandomIntGenerator implements UniqueIdentifierGenerator
|
||||||
{
|
{
|
||||||
|
public static int $min = 0;
|
||||||
|
public static int $max = PHP_INT_MAX;
|
||||||
|
|
||||||
public static function generate(Model $model): string|int
|
public static function generate(Model $model): string|int
|
||||||
{
|
{
|
||||||
return random_int(0, PHP_INT_MAX);
|
return random_int(static::$min, static::$max);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue