# Label Model

DB Table Name {wp_db_prefix}_fbs_board_terms
Schema Check Schema
Source File fluent-boards/app/Models/Label.php
Name Space FluentBoards\App\Models
Class FluentBoards\App\Models\Label

# Attributes

Attribute Data Type Comment
id INT UNSIGNED Auto Increment Primary key of the term
board_id INT UNSIGNED ID of the board associated with the term
title VARCHAR(100) NULL Title of the stage or label. In case of a label, the title can be null with only a color.
slug VARCHAR(100) NULL Slug of the stage or label
type VARCHAR(50) NOT NULL DEFAULT 'stage' Type of the term: 'stage' or 'label'
position DECIMAL(10,2) NOT NULL DEFAULT '1' Position of the stage or label. 1 = first, 2 = second, etc.
color VARCHAR(50) NULL Text color of the stage or label
bg_color VARCHAR(50) NULL Background color of the stage or label
settings TEXT NULLSerialized settings for the term
archived_at TIMESTAMP NULLTimestamp when the term was archived
created_at TIMESTAMP NULL Timestamp when the term was created
updated_at TIMESTAMP NULL Timestamp when the term was last updated

# Usage

Please check Model Basic for Common methods.

# Accessing Attributes


$label = FluentBoards\App\Models\Label::find(1);

$label->id; // returns id
$label->title; // returns title
.......
1
2
3
4
5
6

# Relations

This model has the following relationships that you can use

# tasks

Access the associated tasks of a model

  • return FluentBoards\App\Models\Task Model Collection

# Example:

// Accessing Stages
$labelTasks = $label->tasks;

// For Filtering by tags relationship

// Get Labels which has task type: task
$lables = FluentBoards\App\Models\Label::whereHas('tasks', function ($query) {
                $query->where('type', 'task');
            })->get();

// Get Labels which does not have task type: task
$campaigns = FluentBoards\App\Models\Label::whereDoesntHave('tasks', function ($query) {
                $query->where('type', 'task');
            })->get();

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15