Badge on sub-navigation

Is it possible to create a badge with a relation count of the ownerRecord() on the new sub navigation menu?
Solution:
```php public static function getNavigationBadge(): ?string { return Number::format( number: Livewire::current()->getRecord()->subscribers()->count(),...
Jump to solution
2 Replies
BlackShadow
BlackShadow6mo ago
public static function getNavigationBadge(): ?string
{
return "Count here"; // static won't work here or Using $this when not in object context
}
public static function getNavigationBadge(): ?string
{
return "Count here"; // static won't work here or Using $this when not in object context
}
Solution
BlackShadow
BlackShadow6mo ago
public static function getNavigationBadge(): ?string
{
return Number::format(
number: Livewire::current()->getRecord()->subscribers()->count(),
);
}
public static function getNavigationBadge(): ?string
{
return Number::format(
number: Livewire::current()->getRecord()->subscribers()->count(),
);
}