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'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { Goal::destroy($id); return redirect('/back/goals'); }