Skip to content
View as Markdown

Label Model

DB Table Name{wp_db_prefix}_fc_terms
SchemaCheck Schema
Source Filefluent-crm/app/Models/Label.php
Name SpaceFluentCrm\App\Models
ClassFluentCrm\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

AttributeData TypeComment
idInteger
parent_idInteger
slugString
titleString
descriptionText
positionInteger
settingsTextSerialized array, contains 'color' key
created_atDate Time
updated_atDate 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]);