I just noticed that my where status = blocked
is not being considered.
The query is still returning blocked and active status.
$contacts = DB::table('contacts')
->where('uid_by', $me)
->orWhere('uid_to', $me)
->where('status', 'blocked')
->select(
DB::raw("IF(uid_by = $me, uid_to, uid_by) AS user_id")
)
->get();
What could be wrong with the query?
I tried logging the query being executed:
{"query":"select IF(uid_by = 3, uid_to, uid_by) AS user_id from `contacts` where `uid_by` = ? or `uid_to` = ? and `status` = ?","bindings":[3,3,"blocked"],"time":0}
used:
$queries = DB::getQueryLog();
return $last_query = end($queries);