1 | <?php |
||
14 | class Project extends Model |
||
15 | { |
||
16 | use IsMeasurable, HasUsers, HasStatus; |
||
17 | |||
18 | protected $table = 'projects'; |
||
19 | |||
20 | public $primaryKey = 'id'; |
||
21 | |||
22 | public $guarded = ['id']; |
||
23 | |||
24 | public $timestamps = true; |
||
25 | |||
26 | private $user_model; |
||
27 | |||
28 | protected $dates = [ |
||
29 | 'started_at', |
||
30 | 'delivered_at', |
||
31 | 'expected_at', |
||
32 | ]; |
||
33 | |||
34 | protected $casts = [ |
||
35 | 'visible' => 'boolean', |
||
36 | ]; |
||
37 | |||
38 | public function __construct(array $attributes = []) |
||
44 | |||
45 | public function owner() : BelongsTo |
||
46 | { |
||
47 | return $this->belongsTo(user_model()); |
||
48 | } |
||
49 | |||
50 | public function status() : BelongsTo |
||
54 | |||
55 | public function tasks() : MorphToMany |
||
59 | |||
60 | public function isVisible() : bool |
||
64 | |||
65 | public function isNotVisible() : bool |
||
69 | |||
70 | public function dueIn(string $format = 'days') : int |
||
88 | } |
||
89 |