Total Complexity | 3 |
Total Lines | 93 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | class UserTask extends Model |
||
28 | { |
||
29 | use SoftDeletes; |
||
30 | |||
31 | /** @var int */ |
||
32 | const STATUS_ASSIGNED = 0; |
||
33 | |||
34 | /** @var int */ |
||
35 | const STATUS_COMPLETED = 1; |
||
36 | |||
37 | /** @var bool */ |
||
38 | public $timestamps = true; |
||
39 | |||
40 | /** @var string */ |
||
41 | protected $table = 'user_tasks'; |
||
42 | |||
43 | /** @var array */ |
||
44 | protected $fillable = [ |
||
45 | 'user_id', |
||
46 | 'assigned_user_id', |
||
47 | 'description', |
||
48 | 'deadline', |
||
49 | 'status' |
||
50 | ]; |
||
51 | |||
52 | /** @var array */ |
||
53 | protected $visible = [ |
||
54 | 'id', |
||
55 | 'user_id', |
||
56 | 'assigned_user_id', |
||
57 | 'description', |
||
58 | 'deadline', |
||
59 | 'status', |
||
60 | 'created_at', |
||
61 | 'updated_at', |
||
62 | 'user', |
||
63 | 'assignedUser' |
||
64 | ]; |
||
65 | |||
66 | /** @var array */ |
||
67 | protected $casts = [ |
||
68 | 'status' => 'int' |
||
69 | ]; |
||
70 | |||
71 | /** @var array */ |
||
72 | protected $sortable = [ |
||
73 | 'id', |
||
74 | 'description', |
||
75 | 'deadline', |
||
76 | 'status', |
||
77 | 'created_at', |
||
78 | 'updated_at', |
||
79 | ]; |
||
80 | |||
81 | /** @var array */ |
||
82 | protected $searchable = [ |
||
83 | 'description' |
||
84 | ]; |
||
85 | |||
86 | /** @var array */ |
||
87 | protected $filterable = [ |
||
88 | 'user_id', |
||
89 | 'status' |
||
90 | ]; |
||
91 | |||
92 | /** |
||
93 | * User. |
||
94 | * |
||
95 | * @return BelongsTo |
||
96 | */ |
||
97 | public function user() |
||
98 | { |
||
99 | return $this->belongsTo(User::class, 'user_id', 'id'); |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * User assigned. |
||
104 | * |
||
105 | * @return BelongsTo |
||
106 | */ |
||
107 | public function assignedUser() |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * @param $value |
||
114 | * |
||
115 | * @return Carbon |
||
116 | */ |
||
117 | public function getDeadlineAttribute($value) |
||
122 |