diff --git a/routes/web.php b/routes/web.php index 2dd19e9..91d1e73 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,10 +1,10 @@ name('about'); - // Task 4: redirect the GET URL "log-in" to a URL "login" // Put one code line here below Route::get('/log-in', function () { return redirect('/login'); }); @@ -44,10 +42,34 @@ Route::get('/log-in', function () { return redirect('/login'); }); // Tasks inside that Authenticated group: +Route::middleware('auth')->group(function () { + Route::view('/app/dashboard', view: 'dashboard')->name('dashboard'); + Route::get('/app/tasks', [TaskController::class, 'index'])->name('tasks.index');; +}); + // Task 6: /app group within a group // Add another group for routes with prefix "app" // Put one Route Group code line here below +Route::prefix('app') +->name('tasks.') + ->middleware('auth') + ->group(function () { + Route::get('/tasks', [TaskController::class, 'index'])->name('index'); + + Route::post('/tasks', [TaskController::class, 'store'])->name('store'); + + Route::get('/tasks/create', [TaskController::class, 'create'])->name('create'); + + Route::get('/tasks/{task}', [TaskController::class, 'show'])->name('show'); + + Route::get('/tasks/{task}/edit', [TaskController::class, 'edit'])->name('edit'); + + Route::put('/tasks/{task}', [TaskController::class, 'update'])->name('update'); + + Route::delete('/tasks/{task}', [TaskController::class, 'destroy'])->name('destroy'); + }); + // Tasks inside that /app group: // Task 7: point URL /app/dashboard to a "Single Action" DashboardController