关于model的with方法

浏览:4506 发布日期:2017/01/10 分类:求助交流
$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这个模型的呢
最佳答案
评论( 相关
后面还有条评论,点击查看>>