diff --git a/app/Auth/Role.php b/app/Auth/Role.php index d6c4a09519e..8f9702fa0e3 100644 --- a/app/Auth/Role.php +++ b/app/Auth/Role.php @@ -111,7 +111,13 @@ public static function getRole(string $displayName): ?self */ public static function getSystemRole(string $systemName): ?self { - return static::query()->where('system_name', '=', $systemName)->first(); + static $cache = []; + + if (!isset($cache[$systemName])) { + $cache[$systemName] = static::query()->where('system_name', '=', $systemName)->first(); + } + + return $cache[$systemName]; } /**