模型的方法

 


 

获取模型对应的DB实例

 

UserModel::db()

 

快捷查询

 

UserModel::when($column, $operator = null, $value = null)

 

UserModel::when()
等价于
UserModel::instance()->where()
Db::table('user')->where()

 

$users = UserModel::when('level', 5)->fields('id, name')->select();