Adding a record count alongside a navigation link

Hi could you point me to the feature that enables the display of the number of orders (in this case 193) shown in the attached?
I can see it's related to the number of "new" orders - just need to understand how the number gets put there. I have had a look at the source code on github and see the navigation title definition here
protected static ?string $navigationGroup = 'Shop';

protected static ?string $navigationIcon = 'heroicon-o-shopping-bag';
protected static ?string $navigationGroup = 'Shop';

protected static ?string $navigationIcon = 'heroicon-o-shopping-bag';
Anyone able to point me to the documentation or the relevant file within github? thx j
No description
Solution:
public static function getNavigationBadge(): ?string
{
return 420;
}
public static function getNavigationBadge(): ?string
{
return 420;
}
...
Jump to solution
7 Replies
Solution
Patrick
Patrick5w ago
public static function getNavigationBadge(): ?string
{
return 420;
}
public static function getNavigationBadge(): ?string
{
return 420;
}
This in your resource class if i'm correct
Patrick
Patrick5w ago
Yep:
No description
Patrick
Patrick5w ago
If you take a peek into the Resource class itself, you'll find a lot of public methods that you can use
CodeWithDennis
I made a post about navigation badges yesterday hopefully it helps; https://x.com/CodeWithDennis/status/1848263961294041246 (Laravel v11.23 if you want to use Flexible)
CodeWithDennis (@CodeWithDennis) on X
Here's a handy trick for your @filamentphp count badges using @laravelphp flexible caching. If the cache is fresh, it's returned instantly. If stale, the old value is sent while the cache updates in the background. If expired, the value is recalculated.
From An unknown user
Twitter
jjo63
jjo63OP5w ago
Thanks patrick, I was literally about to update this as I had found the solution within the resouce file on github.
jjo63
jjo63OP5w ago
Is this the resolution to the request discussed here https://github.com/filamentphp/filament/discussions/7221 ?
GitHub
refresh navigation badge · filamentphp filament · Discussion #7221
Table polling works fine, but how can I update the corresponding navigation badge so that they are in sync?
CodeWithDennis
No.
Want results from more Discord servers?
Add your server