tp5.1 模型 where多条件查询 like 查询

来源:https://blog.csdn.net/qq_41241684/article/details/87866416

所以我改成这样:

$paperTypeModel = new PaperType();
        $seach = Request::get('seach');
        $where = array();
        if (!empty($seach))
        {
            $where[] = ['name', 'like', '%'.$seach."%"];
        }
        $list = $paperTypeModel::where($where) -> where(['if_delete'=>1])
                                ->paginate(15)-> each(function ($item, $key){
                $item->statusName = $this->status[$item->status];
        });

 

posted @ 2020-04-10 17:59  1O(∩_∩)O1  阅读(3121)  评论(0编辑  收藏  举报