counts not working on relationship

I'm trying to add a column that shows a count of the related records. This code correctly displays JSON output of the related records, so I know it's getting them correctly, but counts() doesn't work.

This gets results from the relationship:

TextColumn::make('goals'),

This fails with: Call to a member function goals() on null

TextColumn::make('goals_count')->counts("goals"),

Here are the relationships:
    public function mission()
    {
        return $this->belongsTo(Mission::class, 'mission_id', 'id');
    }

    public function goals()
    {
        return $this->mission->goals()->with('mission');
    }

Where am I going wrong?
Was this page helpful?