I have something like $user->albums()->where('col', NULL)
, it works fine then I tried to extend it to empty strings with $user->albums()->where('col', NULL)->or_where('col', '')
and it's not working.
Also I saw on this post that I could use where_null('col')
but it's not working and it's not documented. Any simple method to select where empty or NULL col
Try using orWhereNull
for the second clause:
$users = DB::table('users')
->where('col', '=', '')
->orWhereNull('col')
->get();
How about this:
$user->albums()->whereRaw("NOT col > ''")
This way you can check both conditions at the same time
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With