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];
        });

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM