Doubts with getEloquentQuery()

I have a question, the getNavigationBadge, counts all the unprocessed records, but without filtering by employee in case that he is not an administrator. How could I make it filter without having to add the admin condition to getNavigationBadge?

public static function getEloquentQuery(): Builder
{
    if (isAdmin()) {
        $query = parent::getEloquentQuery()
            ->withoutGlobalScopes([
                SoftDeletingScope::class,
            ]);

    } else {
        $query = parent::getEloquentQuery()->whereBelongsTo(auth()->user(), 'employee')
            ->withoutGlobalScopes([
                SoftDeletingScope::class,
            ]);

    return $query;
}

protected static function getNavigationBadge(): ?string
{
    return parent::getEloquentQuery()->where('is_processed', 0)->count();
}
Was this page helpful?