$this->model
->join('user_credentials', 'upload_conversions.user_id', '=', 'user_credentials.user_id')
->select(
'upload_conversions.id',
'upload_conversions.status',
'upload_time',
'user_credentials.user_id',
DB::raw('CONCAT(user_credentials.first_name, " ", user_credentials.last_name) as user_name')
)
->where('upload_conversions.status', '!=', 'x')
->groupBy('upload_time')
->get();
In the above query I cannot seem to use the field "status" in my where clause with Laravel's eloquent.
Please notice the "!=", it shouldn't matter what the string contains. If I change the where to use any other field, the query works like it should.
I cannot seem to find any answers and I cannot believe I'm the first to use a field name "status" in a where clause.
So what am I doing wrong?
UPDATE: The problem is that i'm getting no error, but also no results. Where it should have plenty results. Changing the field in the where gives results..
UPDATE: It is because of NULL values. NULL in SQL should also not be a string so why is this not working? Is this a Laravel bug?
ANSWER:
->where('upload_conversions.status', '!=', 'test')
->orWhereNull('upload_conversions.status')
Really ugly, but this works.