Going deeper on Tenant relationships

I'm trying to create a resource for a child of a resource that belongs to my tenant. But since the child resource doesn't have a direct relation to the tenant, when I try to view the list page, I'm getting an error as such. I'm likely missing something obvious, and don't know if this is a Filament question or general Laravel question.

The error message:
The model [App\Models\Button] does not have a relationship named [agency]. You can change the relationship being used by passing it to the [ownershipRelationship] argument of the [tenant()] method in configuration. You can change the relationship being used per-resource by setting it as the [$tenantOwnershipRelationshipName] static property on the [App\Filament\App\Resources\ButtonResource] resource class.

Button BelongsTo ButtonGroup
ButtonGroup BelongsTo Agency
Agency is my Tenant

I have tried and failed to add an
agency(): BelongsTo
function into my Button model, but can't get one to work.
Solution
I found this closed Issue (https://github.com/filamentphp/filament/issues/8468), which references the
\Znck\Eloquent\Relations\BelongsToThrough
. Looked it up and installed the
staudenmeir/belongs-to-through
package. I have gotten past my errors.
Was this page helpful?