How to use nested relationship in SelectFilter?

I have State, City and Suburb models.

Suburb belongs to City, City belongs to State.

In table TextColumn::make('city.state.name') is working fine.

But in table select filter I am getting following error.

SelectFilter::make('state')->relationship('city.state', 'name')

Call to undefined method App\Models\Suburb::city.state()
Was this page helpful?