'string', 'description' => 'string', 'active' => 'boolean' ]; /** * Validation rules * * @var array */ public static $rules = [ 'type_id' => 'required', 'title' => 'required', 'status' => 'required' ]; public function departments() { return $this->morphedByMany(Department::class, 'assignee', 'task_assignees', 'assignment_id'); } public function users() { return $this->morphedByMany(User::class,'assignee', 'task_assignees', 'assignment_id'); } public function trackers() { return $this->morphToMany(User::class, 'trackable', 'time_trackers')->withPivot('time_start', 'time_end'); } public function comments() { return $this->morphToMany(User::class, 'commentable', 'comments')->withPivot('id', 'comment', 'created_at'); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo **/ public function milestone(): BelongsTo { return $this->BelongsTo(ProjectMilestone::class, 'milestone_id', 'id'); } /** * @return BelongsTo */ public function taskType(): BelongsTo { return $this->BelongsTo(ModularType::class, 'type_id', 'id'); } /** * @return \Illuminate\Database\Eloquent\Relations\BelongsTo **/ public function currentStatus(): BelongsTo { return $this->BelongsTo(ModularType::class, 'status', 'id')->withTrashed(); } }