# Board Model

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

# Attributes

Attribute Data Type Comment
id INT UNSIGNED Auto Increment Primary key of the board
parent_id INT UNSIGNED NULL For SuperBoard like Project or Company, for sub-board etc.
title TEXT NULLTitle of the board, it can be longer than 255 characters.
description LONGTEXT NULL Description of the board
type VARCHAR(50) NULL Type of the board, e.g., to-do, sales-pipeline, roadmap, task, etc.
currency VARCHAR(50) NULL Currency related to the board
background TEXT NULL Serialized array for background settings
settings TEXT NULL Serialized array for other board settings
created_by INT UNSIGNED ID of the user who created the board
archived_at TIMESTAMP NULLTimestamp when the board was archived
created_at TIMESTAMP NULL Timestamp when the board was created
updated_at TIMESTAMP NULL Timestamp when the board was last updated

# Usage

Please check Model Basic for Common methods.

# Accessing Attributes


$board = FluentBoards\App\Models\Board::find(1);

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

# Scopes

This model has the following scopes that you can use

# byAccessUser($userId)

Filter board by user id

  • Parameters
    • $userId - numeric user id

# Usage:

// Get all boards by user id
$bards = FluentBoards\App\Models\Board::byAccessUser($userId)->get();
1
2

# Relations

This model has the following relationships that you can use

# stages

Access the associated stages of a model

  • return FluentBoards\App\Models\Stage Model Collection

# Example:

// Accessing Stages
$boardStages = $board->stages;

// For Filtering by tags relationship

// Get Boards which has stage slug: completed
$boards = FluentBoards\App\Models\Board::whereHas('tasks', function ($query) {
                $query->where('type', 'task');
            })->get();

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

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

# tasks

Access all the associated tasks of a model

  • return FluentBoards\App\Models\Task Model Collections

# Example:

// Accessing board tasks
$boardTasks = $board->tasks;

// For Filtering by tags relationship

// Get Board which has task type: task
$boards = FluentBoards\App\Models\Board::whereHas('tasks', funtion($query) {
    $query->where('type', 'task');
})->get();

// Get Board which does not have task type: task
$boards = FluentBoards\App\Models\Board::whereDoesntHave('tasks', funtion($query) {
    $query->where('type', 'task');
})->get();
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# users

Access all the associated users of a Board model

  • return FluentBoards\App\Models\User Model Collections

# Example:

// Accessing All the users of board
$campaignSubjects = $campaign->users;
1
2

# Methods

Along with Global Model methods, this model has few helper methods.

# updateMeta($key, $value)

Update or create a meta entry for the board.

  • Parameters
    • $key string
    • $key string
  • Returns array

# Usage

$meta = $board->updateMeta('enable_stage_change_email', $enable_stage_change_email);
1