laravel sql闭包用法 where orwhere条件

场景:sql查询时我需要第一个条件必须,第二个条件中两个字段有一个

$yaml_data = SystemConfig::Where('application_item', $where['application_item'])
    ->where(function($query) use ($keywords) {
        $query->orwhere('config_item', 'like', "%{$keywords}%")
            ->orwhere('describe', 'like', "%{$keywords}%");
            })->paginate()->toArray();

猜你喜欢

转载自blog.csdn.net/yu_20170610/article/details/85771543