laravel admin 过滤字段是否为null

2024-04-30  本文已影响0人  苍老师的眼泪

$filter->where(function ($query) {

    // logger($this->input);

    if ($this->input == 1)
        $query->whereNull('jz_cx_gid');
    else if ($this->input == 2)
        $query->whereNotNull('jz_cx_gid');

}, 'gid是否为空')->radio([
    '' => '不作选择',
    1 => '为空',
    2 => '不为空', 
]);

上一篇 下一篇

猜你喜欢

热点阅读