/** * 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]); }
public function all() { $taskCategories = TaskCategory::all(); return response()->json($taskCategories); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $task = TaskCategory::findOrFail($id); return view('pages.dashboard')->with('users', User::all())->with('task_categories', TaskCategory::all())->with('t', $task); }