Eloquent でフィールドが null でないかどうかをどのように確認しますか?
試してみましたが、比較ではなくバインディングとしてModel::where('sent_at', 'IS NOT', DB::raw('null'))->...
表示されます。IS NOT
これDB::getQueryLog()
については次のように書かれています。
'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
ベストアンサー1
Eloquent にはそのためのメソッドがあります (Laravel 4.*/5.*)。
Model::whereNotNull('sent_at')
ララベル3:
Model::where_not_null('sent_at')