如果这个问题重复,我深表歉意。我如何从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