标签关系

This commit is contained in:
2025-03-27 11:13:46 +08:00
parent 6e79dd47c4
commit aff152e40d
7 changed files with 90 additions and 5 deletions
+9
View File
@@ -96,4 +96,13 @@ class Customer extends Model
return $customer;
}
/**
* 客户的标签
*/
public function tags()
{
return $this->belongsToMany(Tag::class, 'customer_tag', 'customer_id', 'tag_id')
->withTimestamps(); // 如果需要记录关联时间
}
}