laravel 写function builder where 条件

if (isset($data['txnTimeStart']) && !empty($data['txnTimeStart'])) {
            //['r.txnTime','>=',$data['txnTimeStart']];
            $where[] =  [function(Builder $builder)use($data){
                $builder->whereRaw("DATE_FORMAT(r.txnTime,'%Y-%m-%d') >= {$data['txnTimeStart']}");
            }];
        }

posted @ 2023-01-17 18:13  Bashuslovakia  阅读(70)  评论(0编辑  收藏  举报