/** * Delete task associated to project as well * @return bool */ protected function beforeDelete() { if (parent::beforeDelete()) { foreach ($this->tasks as $task) { $task->delete(); } foreach ($this->auditEvents as $auditEvent) { $auditEvent->delete(); } return true; } return false; }