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