From 8f7b8e971a8d89b9e6dfc81535ee20c0bc5bc8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Tue, 21 Jan 2025 14:16:52 +0100 Subject: [PATCH] make int ranges configurable --- src/UniqueIdentifierGenerators/RandomIntGenerator.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/UniqueIdentifierGenerators/RandomIntGenerator.php b/src/UniqueIdentifierGenerators/RandomIntGenerator.php index 57c704cc..427dff1a 100644 --- a/src/UniqueIdentifierGenerators/RandomIntGenerator.php +++ b/src/UniqueIdentifierGenerators/RandomIntGenerator.php @@ -9,13 +9,14 @@ use Stancl\Tenancy\Contracts\UniqueIdentifierGenerator; /** * Generates a cryptographically secure random integer for the tenant key. - * - * The integer is generated in range (0, PHP_INT_MAX). */ class RandomIntGenerator implements UniqueIdentifierGenerator { + public static int $min = 0; + public static int $max = PHP_INT_MAX; + public static function generate(Model $model): string|int { - return random_int(0, PHP_INT_MAX); + return random_int(static::$min, static::$max); } }