How do you check if a field is not null with Eloquent?
I tried Model::where('sent_at', 'IS NOT', DB::raw('null'))->...
but it gives IS NOT
as a binding instead of a comparison.
This is what DB::getQueryLog()
says about it:
'query' => string 'select * from my_table where sent_at = ? and profile_id in (?, ?) order by created_at desc' (length=101)
'bindings' =>
array (size=3)
0 => string 'IS NOT' (length=6)
1 => int 1
2 => int 4
Eloquent has a method for that (Laravel 4.*/5.*);
Model::whereNotNull('sent_at')
Laravel 3:
Model::where_not_null('sent_at')