->relationship() with hasOneThrough() relation doesn't work anymore
Hi guys, in my Account model I have this relation:
In v2 I used this and it worked perfectly:
Now it gives me this error:
Filament\Forms\Components\Select::getRelationship(): Return value must be of type Illuminate\Database\Eloquent\Relations\BelongsTo|Illuminate\Database\Eloquent\Relations\BelongsToMany|Znck\Eloquent\Relations\BelongsToThrough|null, Illuminate\Database\Eloquent\Relations\HasOneThrough returned
Is there a way to solve this without manually giving options and a query method myself, like it used to be?
Solution:Jump to solution
The only solution for now seems to be to use this package:
https://github.com/staudenmeir/belongs-to-through
And the relationship should look like htis:
...
GitHub
GitHub - staudenmeir/belongs-to-through: Laravel Eloquent BelongsTo...
Laravel Eloquent BelongsToThrough relationships. Contribute to staudenmeir/belongs-to-through development by creating an account on GitHub.
2 Replies
Solution
The only solution for now seems to be to use this package:
https://github.com/staudenmeir/belongs-to-through
And the relationship should look like htis:
GitHub
GitHub - staudenmeir/belongs-to-through: Laravel Eloquent BelongsTo...
Laravel Eloquent BelongsToThrough relationships. Contribute to staudenmeir/belongs-to-through development by creating an account on GitHub.
An extra note, that using this package, the indicators don't work as intended, they display the name of the middle class and not the target class. You can solve this like this: