1 | <?php |
||
14 | class Project extends Model |
||
15 | { |
||
16 | use HasUsers, HasStatus; |
||
17 | |||
18 | protected $table = 'projects'; |
||
19 | |||
20 | public $primaryKey = 'id'; |
||
21 | |||
22 | public $guarded = ['id']; |
||
23 | |||
24 | public $timestamps = true; |
||
25 | |||
26 | protected $dates = [ |
||
27 | 'started_at', |
||
28 | 'delivered_at', |
||
29 | 'expected_at', |
||
30 | ]; |
||
31 | |||
32 | protected $casts = [ |
||
33 | 'visible' => 'bool', |
||
34 | ]; |
||
35 | |||
36 | public function __construct(array $attributes = []) |
||
40 | |||
41 | public function author() : BelongsTo |
||
45 | |||
46 | public function owner() : BelongsTo |
||
50 | |||
51 | public function status() : BelongsTo |
||
55 | |||
56 | public function tasks() : MorphToMany |
||
60 | |||
61 | public function comments() : MorphMany |
||
65 | |||
66 | public function isVisible() : bool |
||
70 | |||
71 | public function isNotVisible() : bool |
||
75 | |||
76 | public function dueIn(string $format = 'days') : int |
||
94 | |||
95 | public function assignTask(Task $task) : void |
||
101 | |||
102 | public function removeTask(Task $task) : void |
||
108 | |||
109 | public function hasTask(Task $task) : bool |
||
115 | |||
116 | /** |
||
117 | * Has the task got an expected target. |
||
118 | * |
||
119 | * @return bool |
||
120 | */ |
||
121 | public function hasDateTarget() : bool |
||
125 | |||
126 | /** |
||
127 | * Is the task still in process. |
||
128 | * |
||
129 | * @return bool |
||
130 | */ |
||
131 | public function isInProcess() : bool |
||
135 | |||
136 | /** |
||
137 | * Is the task not due yet. |
||
138 | * |
||
139 | * @return bool |
||
140 | */ |
||
141 | public function notDueYet() : bool |
||
145 | |||
146 | /** |
||
147 | * Is the task complete. |
||
148 | * |
||
149 | * @return bool |
||
150 | */ |
||
151 | public function completed() : bool |
||
161 | |||
162 | /** |
||
163 | * Was the task completed after the given deadline. |
||
164 | * |
||
165 | * @return bool |
||
166 | */ |
||
167 | public function completedAfterSchedule() : bool |
||
171 | |||
172 | /** |
||
173 | * Was the task completed before the given deadline. |
||
174 | * |
||
175 | * @return bool |
||
176 | */ |
||
177 | public function completedBeforeSchedule() : bool |
||
181 | |||
182 | /** |
||
183 | * Was the task completed before or on the given deadline. |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | public function completedOnSchedule() : bool |
||
191 | |||
192 | /** |
||
193 | * Is the task overdue. |
||
194 | * |
||
195 | * @return bool |
||
196 | */ |
||
197 | public function isOverdue() : bool |
||
201 | |||
202 | /** |
||
203 | * Have all tasks been completed. |
||
204 | * |
||
205 | * @return bool |
||
206 | */ |
||
207 | public function completedAllTasks() : bool |
||
217 | } |
||
218 |