PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / 1.22
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration v1.22
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 / Activity.php

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

77 lines 1.8 KB
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
7 class Activity extends Model
8 {
9 protected $table = 'fbs_activities';
10
11 protected $guarded = ['id'];
12
13 protected $fillable = [
14 'object_id',
15 'object_type',
16 'action',
17 'column',
18 'old_value',
19 'new_value',
20 'description',
21 'settings',
22 'created_by'
23 ];
24
25 public static function boot()
26 {
27 parent::boot();
28 static::creating(function ($model) {
29 $model->created_by = $model->created_by ?: get_current_user_id();
30 $model->created_at = current_time('mysql');
31 $model->updated_at = current_time('mysql');
32 });
33 }
34
35 public function setSettingsAttribute($settings)
36 {
37 $this->attributes['settings'] = \maybe_serialize($settings);
38 }
39
40 public function getSettingsAttribute($settings)
41 {
42 return \maybe_unserialize($settings);
43 }
44
45 /**
46 * One2One: Activity belongs to one Task
47 * @return \FluentBoards\Framework\Database\Orm\Relations\BelongsTo
48 */
49 public function board()
50 {
51 return $this->belongsTo(Board::class, 'object_id', 'id');
52 }
53
54 /**
55 * One2One: Activity belongs to one Task
56 * @return \FluentBoards\Framework\Database\Orm\Relations\BelongsTo
57 */
58 public function task()
59 {
60 return $this->belongsTo(Task::class, 'object_id', 'id');
61 }
62
63 /**
64 * One2One: Activity belongs to one User
65 * @return \FluentBoards\Framework\Database\Orm\Relations\BelongsTo
66 */
67 public function user()
68 {
69 return $this->belongsTo(User::class, 'created_by', 'ID');
70 }
71
72 public function scopeType($query, $type)
73 {
74 return $query->where('object_type', $type);
75 }
76 }
77