【发布时间】:2015-07-13 16:04:54
【问题描述】:
我正在尝试选择列名为“review”的“用户”表中的所有非空列。
$applications = DB::table('users')
->join('applications', 'user.update_id', '=', 'applications.id')
->whereNotNull('users.review')
->select('user.id', 'user.rating', 'user.appid', 'user.review', 'applications.title', 'applications.price', 'applications.icon_uri')
->orderBy('user.id','asc')
->paginate(20);
$applications->setPath('');
return $applications;
但是返回的数据包括'user.review'空和非空的所有信息。
感觉whereNotNull()没有效果,也没有发现语句有错误。
我试着移动->whereNotNull('user.review')这条线的顶部和底部结果是一样的。
我什至尝试删除 select 和 orderBy 但返回相同的数据。
$applications = DB::table('users')
->join('applications', 'user.update_id', '=', 'applications.id')
->whereNotNull('users.review')
->paginate(20);
$applications->setPath('');
return $applications;
有没有办法让它工作?
【问题讨论】:
标签: php mysql laravel-4 eloquent laravel-5