Table filter with a relationship like so?

Well I know it fails with 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;
    }
Was this page helpful?