laravel中的whereNull和whereNotNull

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字段都不为空

╰︶﹉⋛⋋⊱⋋๑๑⋌⊰⋌⋚﹉︶╯
原文地址:https://www.cnblogs.com/zhangcheng001/p/11373635.html