$list = User::with('profile.phone')->select([1,2,3]);
foreach($list as $user){
// 获取用户关联的phone模型
dump($user->profile->phone);
}实际操作中$list = User::with('profile.phone')->where('phone.type',1)->select([1,2,3]); 报错 Column not found: 1054 Unknown column 'phone.type' in 'where clause'为什么实际上是取不到phone这个模型的呢
最佳答案