public function addMember($project_id, $user_id) { $member = $this->repository->hasMember($user_id, $project_id); if (count($member) === 0) { return is_null(Project::find($project_id)->members()->attach($user_id)); } return false; }
public function removeProject($projectId) { $project = Project::find($projectId); if (!is_null($project)) { $project->members()->detach(); $project->tasks()->delete(); $project->notes()->delete(); return $project->delete(); } return true; }