Add ToggleComplete for TaskController

This commit is contained in:
Thuan Bui
2025-03-06 22:25:46 +09:00
parent 11826da4c9
commit da2c4eeb6d
5 changed files with 34 additions and 18 deletions
+4 -4
View File
@@ -10,10 +10,10 @@ use Illuminate\Support\Facades\Auth;
class TaskController extends Controller
{
public function index() {
$task = Task::latest('updated_at')->Paginate(20);
return view('task.index', [
'tasks' => $task
]);
$totalTasks = Task::count(); // Count all tasks
$completedTasks = Task::where('completed', true)->count(); // Coun
$tasks = Task::latest('updated_at')->Paginate(20);
return view('task.index', compact('tasks','totalTasks','completedTasks'));
}
public function show(Task $task) {