chore: code style and type declaration improvements

This commit is contained in:
xboard
2025-07-15 02:55:58 +08:00
parent b55a56d6a7
commit d30e9cb30b
6 changed files with 68 additions and 54 deletions
+2 -1
View File
@@ -172,7 +172,8 @@ class GiftCardCode extends Model
public static function generateCode(string $prefix = 'GC'): string
{
do {
$code = $prefix . strtoupper(substr(md5(uniqid(mt_rand(), true)), 0, 12));
$safePrefix = (string) $prefix;
$code = $safePrefix . strtoupper(substr(md5(uniqid($safePrefix . mt_rand(), true)), 0, 12));
} while (self::where('code', $code)->exists());
return $code;