public function destroy($id) { $taskCategory = TaskCategory::findOrFail($id); if ($taskCategory->delete()) { return response(204); } else { return response(500); } }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $task = Task::findOrFail($id); $task->delete(); return view('pages.dashboard')->with('users', User::all())->with('task_categories', TaskCategory::all())->with('tasks', Task::all()); }
public function index() { $tasks = Task::where('is_completed', false)->where('task_category_id', 0)->get(); $taskCategories = TaskCategory::all(); return view('tasks.index', ['pageTitle' => 'Tasks'])->with(['tasks' => $tasks, 'taskCategories' => $taskCategories]); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $task = TaskCategory::findOrFail($id); $task->delete(); return redirect()->back(); }