Added count badge to navigation sidebar

This commit is contained in:
Poseidon281 2024-05-15 16:45:35 +02:00
parent d7ebde5f5f
commit 4ad837ff14
8 changed files with 37 additions and 0 deletions

View File

@ -13,6 +13,10 @@ class ApiKeyResource extends Resource
protected static ?string $model = ApiKey::class;
protected static ?string $label = 'API Key';
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-key';
public static function canEdit($record): bool

View File

@ -10,6 +10,11 @@ class DatabaseHostResource extends Resource
{
protected static ?string $model = DatabaseHost::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $label = 'Databases';
protected static ?string $navigationIcon = 'tabler-database';

View File

@ -10,6 +10,11 @@ class DatabaseResource extends Resource
{
protected static ?string $model = Database::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-database';
protected static bool $shouldRegisterNavigation = false;

View File

@ -10,6 +10,10 @@ class EggResource extends Resource
{
protected static ?string $model = Egg::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-eggs';
protected static ?string $recordTitleAttribute = 'name';

View File

@ -10,6 +10,11 @@ class MountResource extends Resource
{
protected static ?string $model = Mount::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-layers-linked';
public static function getRelations(): array

View File

@ -11,6 +11,11 @@ class NodeResource extends Resource
{
protected static ?string $model = Node::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-server-2';
protected static ?string $recordTitleAttribute = 'name';

View File

@ -10,6 +10,11 @@ class ServerResource extends Resource
{
protected static ?string $model = Server::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-brand-docker';
protected static ?string $recordTitleAttribute = 'name';

View File

@ -11,6 +11,10 @@ class UserResource extends Resource
{
protected static ?string $model = User::class;
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}
protected static ?string $navigationIcon = 'tabler-users';
protected static ?string $recordTitleAttribute = 'username';