© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
9 replies
Mark Chaney

Table filter with a relationship like so?

Well I know it fails with
Call to a member function getRelated() on null
Call to a member function getRelated() on null
, but thought maybe someone had some ideas. Trying to filter properties that belong to a particular project. Properties dont have a direct relationship to a project as you can see.
    public function county(): BelongsTo
    {
        return $this->belongsTo(County::class, 'county_id');
    }
    public function projects(): ?BelongsToMany
    {
        if ($this->county) {
            return $this->county->projects();
        }

        return null;
    }
    public function county(): BelongsTo
    {
        return $this->belongsTo(County::class, 'county_id');
    }
    public function projects(): ?BelongsToMany
    {
        if ($this->county) {
            return $this->county->projects();
        }

        return null;
    }
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

Table Filter, `BooleanConstraint` relationship exists
FilamentFFilament / ❓┊help
3y ago
Filter with recursive relationship
FilamentFFilament / ❓┊help
3y ago
Table apply filter in a eager load relationship
FilamentFFilament / ❓┊help
2y ago
Adding a filter on a RelationManager Table with `relationship` doesn't work
FilamentFFilament / ❓┊help
3y ago