37 lines
632 B
PHP
37 lines
632 B
PHP
<?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);
|
|
}
|
|
}
|