UserModel::delete PHP Method

delete() public method

public delete ( $where = [], $options = [] )
    public function delete($where = [], $options = [])
    {
        if (is_numeric($where)) {
            deprecated('UserModel->delete(int)', 'UserModel->deleteID(int)');
            $result = $this->deleteID($where, $options);
            return $result;
        }
        throw new \BadMethodCallException("UserModel->delete() is not supported.", 400);
    }

Usage Example

Example #1
0
 public function delete()
 {
     $id = request('id');
     if (!$id) {
         $this->error('缺少ID');
     }
     if (UserModel::delete($id)) {
         $this->success('/admin/user');
     } else {
         $this->error('操作失败');
     }
 }
All Usage Examples Of UserModel::delete
UserModel