add superadmin dashboard. subscriptions
This commit is contained in:
@@ -42,6 +42,11 @@ class TwigGlobalsExtension extends AbstractExtension
|
||||
new TwigFunction('role_badge', [$this, 'roleBadge'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('status_badge', [$this, 'statusBadge'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('get_all_roles', [$this, 'getAllRoles'], ['is_safe' => ['html']]),
|
||||
|
||||
// System role functions (superadmin)
|
||||
new TwigFunction('is_superadmin', [$this, 'isSuperadmin'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('is_system_admin', [$this, 'isSystemAdmin'], ['is_safe' => ['html']]),
|
||||
new TwigFunction('get_system_role', [$this, 'getSystemRole'], ['is_safe' => ['html']]),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -137,6 +142,26 @@ class TwigGlobalsExtension extends AbstractExtension
|
||||
return '<span class="badge ' . esc($color) . '">' . esc($label) . '</span>';
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// System Role Functions (superadmin)
|
||||
// ========================================
|
||||
|
||||
public function isSuperadmin(): bool
|
||||
{
|
||||
return service('access')->isSuperadmin();
|
||||
}
|
||||
|
||||
public function isSystemAdmin(): bool
|
||||
{
|
||||
return service('access')->isSystemAdmin();
|
||||
}
|
||||
|
||||
public function getSystemRole(): ?string
|
||||
{
|
||||
return service('access')->getSystemRole();
|
||||
}
|
||||
|
||||
|
||||
public function statusBadge(string $status): string
|
||||
{
|
||||
$colors = [
|
||||
|
||||
Reference in New Issue
Block a user