初始化
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
namespace app\models;
|
||||
|
||||
use core\base\Model;
|
||||
|
||||
/**
|
||||
* 客户模型
|
||||
*/
|
||||
class Customer extends Model
|
||||
{
|
||||
protected $table = 'customer';
|
||||
|
||||
// 获取所有客户
|
||||
public function getAll()
|
||||
{
|
||||
return $this->order(['id ASC'])->fetchAll();
|
||||
}
|
||||
|
||||
// 添加客户
|
||||
public function addCustomer($data)
|
||||
{
|
||||
return $this->add($data);
|
||||
}
|
||||
|
||||
// 更新客户
|
||||
public function updateCustomer($id, $data)
|
||||
{
|
||||
return $this->where(['id = :id'], [':id' => $id])->update($data);
|
||||
}
|
||||
|
||||
// 删除客户
|
||||
public function deleteCustomer($id)
|
||||
{
|
||||
return $this->delete($id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user