/** * @param $taskId */ public function completeTask($taskId) { $task = Task::find($taskId); //See if the task was an appointment and send survey if ($task->name == 'Appointment') { $survey = new SurveyRepo(); $survey->generateSurvey($task->user_id, $task->recruit_id); } $task->completed = true; $task->save(); }