© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
8 replies
morty

Is there a more succinct way of retrieving a count of a resource inside a `ManageRelatedRecords`?

I'm trying to add a navigation badge to a record sub navigation item. Inside my
ManageRelatedRecords
ManageRelatedRecords
page, I'm doing the following:

public static function getNavigationBadge(): ?string
    {
        return self::getResource()::getModel()::where(
            'name_and_address_id',
            request()->route()->parameter('record')
        )
            ->firstOrFail()
            ->notes()
            ->count();
    }
public static function getNavigationBadge(): ?string
    {
        return self::getResource()::getModel()::where(
            'name_and_address_id',
            request()->route()->parameter('record')
        )
            ->firstOrFail()
            ->notes()
            ->count();
    }


I'm wondering if there is a way to get the parent record without doing the
request()->route()->parameter('record')
request()->route()->parameter('record')
search?
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Is there a way to create a resource inside a directory?
FilamentFFilament / ❓┊help
5mo ago
Is there a more elegant way to change breadcrump url in nested resource?
FilamentFFilament / ❓┊help
6mo ago
Is there a way to use Heroicons inside HtmlString?
FilamentFFilament / ❓┊help
3y ago
Is there a way I can put an infolist inside of a wizard modal?
FilamentFFilament / ❓┊help
2y ago