Sep 24, 2020
0
Level 1
MorphTo and then BelongsTo
I have a MorphTo relation and that works great! but in the relation i need to grab the country.
In Laravel it works.
$client = Fund::with('relations', 'relations.fundRelationTable', 'relations.fundRelationTable.country')->find(1018);
In Nova i tried this.
MorphTo::make(__('Type'),'fundRelationTable')->types([Client::class, Contact::class])->searchable(),
BelongsTo::make(__('Country'), 'fundRelationTable.country', Country::class),
Whats works but its not whats i need.
Text::make(__('Country'), function () {
return $this->fundRelationTable->country->name;
}),
who can help me :D
Please or to participate in this conversation.