bezhanSalleh / filament-shield

The easiest and most intuitive way to add access management to your Filament Admin Resources, Pages & Widgets through `spatie/laravel-permission`

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Too many duplicated queries by getNavigationBadge()

zenepay opened this issue · comments

It seems that each raw of table will call to this function getNavigationBadge(), then it created hundreds of multiple duplicated database queries.
image
Anyway, I had minor amend to

    public static function getNavigationBadge(): ?string
    {
        if (!static::$count) {
            static::$count = Utils::isResourceNavigationBadgeEnabled()
                ? static::getModel()::count()
                : null;
        }
        return static::$count;
    } 

Hope this is the right way, otherwise please advise.

don't know what is happening but cannot reproduce your issue. might be some debugbar config thingy
Screenshot 2024-01-28 at 3 00 27 PM