whereNull 相當於 is null
whereNotNull相當於is not null
舉個例子
這是數據庫中的lara表
$res = DB::table('lara')->whereNull('uname')->get(); dd($res);
本條語句輸出結果為 id=6的一條數據 也就是uname字段為空值的那條數據
$res = DB::table('lara')->whereNotNull('uname')->get(); dd($res);
本條語句輸出的結果為數據表中的第1--5條數據 1--5條數據的uname字段都不為空