PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / trunk
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration vtrunk
2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 1.45 All 41 releases
fluent-boards / app / Models / Label.php

Label.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration trunk, at app/Models/Label.php

32 lines 814 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\App\Models;
4
5 use FluentBoards\App\Services\Constant;
6 use FluentBoards\Framework\Database\Orm\Builder;
7
8 class Label extends BoardTerm
9 {
10 public static function boot()
11 {
12 parent::boot();
13 static::creating(function ($model) {
14 $model->type = $model->type ?: 'label'; // default type is label
15 });
16
17 static::addGlobalScope('type', function (Builder $builder) {
18 $builder->where('type', '=', 'label');
19 });
20 }
21
22 public function tasks()
23 {
24 return $this->belongsToMany(
25 Task::class,
26 'fbs_relations',
27 'foreign_id',
28 'object_id'
29 )->withTimestamps()->wherePivot('object_type', Constant::OBJECT_TYPE_TASK_LABEL)->withPivot('settings', 'preferences');
30 }
31 }
32