Label Model
| DB Table Name | {wp_db_prefix}_fc_terms |
|---|---|
| Schema | Check Schema |
| Source File | fluent-crm/app/Models/Label.php |
| Name Space | FluentCrm\App\Models |
| Class | FluentCrm\App\Models\Label |
Global Scope
This model has a global scope that filters by taxonomy_name = 'global_label'. The taxonomy_name is auto-set on create.
Purpose
Labels are used to organize Campaigns and Automation Funnels into categories. They are different from Tags (which are assigned to contacts).
Attributes
| Attribute | Data Type | Comment |
|---|---|---|
| id | Integer | |
| parent_id | Integer | |
| slug | String | |
| title | String | |
| description | Text | |
| position | Integer | |
| settings | Text | Serialized array, contains 'color' key |
| created_at | Date Time | |
| updated_at | Date Time |
Fillable Attributes
php
'parent_id',
'slug',
'title',
'description',
'position',
'settings',
'created_at',
'updated_at'Usage
Labels are associated with Campaigns and Funnels via the fc_term_relations pivot table.
php
// Get all labels
$labels = FluentCrm\App\Models\Label::all();
// Access color from settings
$label = FluentCrm\App\Models\Label::find(1);
$color = $label->settings['color'] ?? '';
// Attach labels to a campaign
$campaign->attachLabels([1, 2, 3]);
// Attach labels to a funnel
$funnel->attachLabels([1, 2]);