You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wkcrm/application/crm/model/Invoice.php

54 lines
1.1 KiB

4 years ago
<?php
/**
* 发票表
*
* @author qifan
* @data 2020-12-07
*/
namespace app\crm\model;
use app\admin\model\Common;
class Invoice extends Common
{
protected $name = 'crm_invoice';
protected $pk = 'invoice_id';
4 years ago
protected $dateFormat = "Y-m-d H:i:s";
4 years ago
/**
* 关联用户模型
*
* @return \think\model\relation\HasOne
*/
public function toCustomer()
{
return $this->hasOne('Customer', 'customer_id', 'customer_id')->bind([
'customer_name' => 'name'
]);
}
/**
* 关联合同模型
*
* @return \think\model\relation\HasOne
*/
public function toContract()
{
return $this->hasOne('Contract', 'contract_id', 'contract_id')->bind([
'contract_number' => 'num',
]);
}
/**
* 关联用户模型
*
* @return \think\model\relation\HasOne
*/
public function toAdminUser()
{
return $this->hasOne('AdminUser', 'id', 'owner_user_id')->bind([
'owner_user_name' => 'realname'
]);
}
}