Laravel:具有枢轴列的hasOneThrough

时间:2020-03-10 19:26:09

标签: laravel eloquent

如果这个问题重复,我深表歉意。我如何从hasOneThrough Laravel关系中获得枢纽?运行以下过程时,我只会收到laravel_through_key,这没有帮助:

return $this->hasOneThrough(
    'App\Models\Saas\Matricol',
    'App\Models\Saas\Pivots\UserMatricol',
    'user_id',
    'id',
    'id',
    'register_id'
) ;

我尝试了with/withPivot,但这些都不起作用:

return $this->hasOneThrough(
    'App\Models\Saas\Matricol',
    'App\Models\Saas\Pivots\UserMatricol',
    'user_id',
    'id',
    'id',
    'register_id'
)->withPivot('*') ; // didn't work

0 个答案:

没有答案