Closed lmeysel closed 1 year ago
Hi @lmeysel, Please share the exception's whole stacktrace. What query are you executing?
Hi thanks for your fast reply. I probably should have pasted the trace right with the issue, then I would have seen the source of my problem occurs while doing something totally different and just "misused" the relation.
Problem does not persist, now everything works fine.
PHP 8.2.6 laravel/framework: 10.15.0 staudenmeir/belongs-to-through 2.13
I have a model
File
, belongs toUser
(via field created_by_id) andUser
belongs to (natural)Person
. I want to list the files with the person who created it:So, I was creating a belongsToThrough relation as
$this->belongsToThrough(Person::class, [User::class], foreignKeyLookup: [User::class => 'created_by_id']);
But the query fails with
BadMethodCallException: Call to undefined method Znck\Eloquent\Relations\BelongsToThrough::getOwnerKeyName()
Looking into the code, it appears getOwnerKeyName does not exist.