public function remove(Objective $objective) { foreach ($objective->actions as $action) { foreach ($action->tasks as $task) { Task::destroy($task->id); } Action::destroy($action->id); } Objective::destroy($objective->id); return redirect('/plan'); }
public function remove(Goal $goal) { if ($goal->body == "Non-Business Plan") { return back(); } foreach ($goal->objectives as $objective) { foreach ($objective->actions as $action) { foreach ($action->tasks as $task) { Task::destroy($task->id); } Action::destroy($action->id); } Objective::destroy($objective->id); } Goal::destroy($goal->id); return redirect('/plan'); }