Asked by: vali ntin
i have this query
$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();
this query get result for all users who have new_comment->1
or new_review->1
or new_salary->1
i have user
table
id
name
status
1
|us_1
|0
2
|us_2
|1
3
|us_3
|1
and notification
table
id
new_comment
new_review
new_salary
1
|0
|1
|1
2
|1
|0
|1
3
|1
|0
|1
this query get all rows because user 1 have status
0 or new_review
1
please any idea
how to verify other where
if user is active , without leftjoin
No comments:
Post a Comment