first(); } /** * 根据名称查找 * @param $name * @return mixed */ static function getByName($name) { return self::where('name', $name)->first(); } /** * 根据code查找 * @param $code * @return mixed */ static function getByCode($code) { return self::where('code', $code)->first(); } /** * 添加记录 * @param $data * @return mixed */ static function addInfo($data) { return self::create($data); } /** * 获取列表 * @return mixed */ static function getList() { return self::paginate(); } /** * 根据id更新 * @param $id id * @param array $params * @return mixed */ static function updateById($id, $params = []) { if ($params) { return self::where('id', $id)->update($params); } } }