Allow to "embed" server list (#1860)

This commit is contained in:
Boy132 2025-11-05 16:18:44 +01:00 committed by GitHub
parent 852f7beb39
commit 4bda7cba75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,10 +10,17 @@ class ServerResource extends Resource
{
protected static ?string $model = Server::class;
protected static string|\BackedEnum|null $navigationIcon = 'tabler-brand-docker';
protected static ?string $slug = '/';
protected static bool $shouldRegisterNavigation = false;
public static function getNavigationBadge(): ?string
{
return (string) user()?->directAccessibleServers()->where('owner_id', user()?->id)->count();
}
public static function canAccess(): bool
{
return true;
@ -25,4 +32,10 @@ class ServerResource extends Resource
'index' => ListServers::route('/'),
];
}
public static function embedServerList(bool $condition = true): void
{
static::$slug = $condition ? null : '/';
static::$shouldRegisterNavigation = $condition;
}
}