public function percantageCompleted() { if (!$this->allTasks() || !$this->allCompletedTasks()) { $totalPercentageTasks = 0; } else { $totalPercentageTasks = $this->allCompletedTasks() / $this->allTasks() * 100; } return $totalPercentageTasks; }