【发布时间】:2017-07-06 16:46:28
【问题描述】:
我有这个问题
$organisationUserNotifications = OrganisationUserNotification::
whereHas('user',function($user){
$user->where('status',STATUS_ACTIVE);
})
->orWhere('new_comment',ORGANISATION_NOTIFICATION_ACTIVE)
->orWhere('new_review',ORGANISATION_NOTIFICATION_ACTIVE)
->orWhere('new_salary',ORGANISATION_NOTIFICATION_ACTIVE)
->get();
此查询为所有拥有new_comment->1 或new_review->1 或new_salary->1 的用户获取结果
我有user 表
idnamestatus1|us_1|02|us_2|13|us_3|1
和notification 表
idnew_commentnew_reviewnew_salary1|0|1|12|1|0|13|1|0|1
此查询获取所有行,因为用户 1 有 status 0 或 new_review 1
请有任何想法
如果用户处于活动状态,如何验证其他where,没有leftjoin
【问题讨论】:
标签: php jquery laravel model-view-controller laravel-5