Files
NewTicket/app/common/model/Customers(待删除).php
2026-05-07 16:37:25 +08:00

33 lines
625 B
PHP

<?php
namespace app\common\model;
use think\Model;
use app\common\model\CustomerEmployees;
class Customers extends Model
{
protected $table = 'customers';
public function employees()
{
return $this->hasMany(CustomerEmployees::class, 'customer_id', 'id');
}
/* 模型事件:在删除客户记录之后执行 */
public static function onAfterDelete($customer)
{
// 删除与该客户相关的员工记录
$customer->employees()->delete();
}
public function getCompanyOfAccount(){
return $this->hasMany(User::class,'company_id','id');
}
}