I have this query in Laravel 5.7:
users = User::where('role', 'sales')
->where('tasks', '!=', 'lead')
->orderBy('last_name')
->get();
I expected this query to get all users that have the sales role, unless they are marked as lead in the tasks
column (which may be NULL
). But now I had to realize that in my app, whenever tasks
is NULL
, the user won't be part of the collection.
Is this usual behaviour? If so, how should I approach this problem? If not, what might cause it?