From 1d20f4668d1a6a7a4fc20b73259f12effc993fa4 Mon Sep 17 00:00:00 2001 From: Emanuel Sige Date: Thu, 22 Aug 2024 04:36:34 +0300 Subject: [PATCH 1/5] Adding missing Route --- routes/api.php | 5 ++++- routes/web.php | 49 +++++++++++++++++++++++++++---------------------- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/routes/api.php b/routes/api.php index 39ecc07c6..28b25b91c 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,5 +1,6 @@ group(function(){ + Route::resource('tasks',TaskController::class); +}); }); diff --git a/routes/web.php b/routes/web.php index 15508ce8d..6432bb3b5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,9 @@ name('about'); // Task 4: redirect the GET URL "log-in" to a URL "login" // Put one code line here below - +Route::redirect('/log-in', '/login'); // Task 5: group the following route sentences below in Route::group() // Assign middleware "auth" // Put one Route Group code line here below - +Route::group(['middleware' => 'auth'], function () { // Tasks inside that Authenticated group: // 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')->group(function () { // Tasks inside that /app group: - // Task 7: point URL /app/dashboard to a "Single Action" DashboardController // Assign the route name "dashboard" // Put one Route Group code line here below + Route::post('/dashboard', [DashboardController::class])->name('dashboard'); // Task 8: Manage tasks with URL /app/tasks/***. // Add ONE line to assign 7 resource routes to TaskController // Put one code line here below - + Route::resource('/tasks', TaskController::class); + }); // End of the /app Route Group - // Task 9: /admin group within a group // Add a group for routes with URL prefix "admin" // Assign middleware called "is_admin" to them // Put one Route Group code line here below + Route::prefix('/admin')->group(function () { + Route::group(['middleware' => 'is_admin'], function () { + // Tasks inside that /admin group: + // Task 10: point URL /admin/dashboard to a "Single Action" Admin/DashboardController + // Put one code line here below + Route::get('/dashboard', [\App\Http\Controllers\Admin\DashboardController::class]); - // Tasks inside that /admin group: - - - // Task 10: point URL /admin/dashboard to a "Single Action" Admin/DashboardController - // Put one code line here below - - - // Task 11: point URL /admin/stats to a "Single Action" Admin/StatsController - // Put one code line here below - + // Task 11: point URL /admin/stats to a "Single Action" Admin/StatsController + // Put one code line here below + Route::get('/stats', [\App\Http\Controllers\Admin\StatsController::class]); + }); + }); // End of the /admin Route Group - +}); // End of the main Authenticated Route Group // One more task is in routes/api.php -require __DIR__.'/auth.php'; +require __DIR__ . '/auth.php'; From ff3c82eef81a2a436056f77809b44311aeeb8338 Mon Sep 17 00:00:00 2001 From: Emanuel Sige Date: Thu, 22 Aug 2024 04:54:39 +0300 Subject: [PATCH 2/5] updated route --- routes/api.php | 7 ++++--- routes/web.php | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/routes/api.php b/routes/api.php index 28b25b91c..3a0e0fe85 100644 --- a/routes/api.php +++ b/routes/api.php @@ -24,7 +24,8 @@ // Keep in mind that prefix should be /api/v1. // Add ONE line to assign 5 resource routes to TaskController // Put one code line here below -Route::prefix('/api/v1')->group(function(){ - Route::resource('tasks',TaskController::class); -}); + Route::prefix('api/v1')->group(function () { + Route::apiResource('tasks', \App\Http\Controllers\TaskController::class); + }); + }); diff --git a/routes/web.php b/routes/web.php index 6432bb3b5..9d90f1952 100644 --- a/routes/web.php +++ b/routes/web.php @@ -71,11 +71,11 @@ // Task 10: point URL /admin/dashboard to a "Single Action" Admin/DashboardController // Put one code line here below - Route::get('/dashboard', [\App\Http\Controllers\Admin\DashboardController::class]); + Route::get('/dashboard', \App\Http\Controllers\Admin\DashboardController::class); // Task 11: point URL /admin/stats to a "Single Action" Admin/StatsController // Put one code line here below - Route::get('/stats', [\App\Http\Controllers\Admin\StatsController::class]); + Route::get('/stats', \App\Http\Controllers\Admin\StatsController::class); }); }); From 42ef47dc9dae270ed490b994396a4aa988911f0a Mon Sep 17 00:00:00 2001 From: Emanuel Sige Date: Thu, 22 Aug 2024 05:16:53 +0300 Subject: [PATCH 3/5] Api Route --- routes/api.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/api.php b/routes/api.php index 3a0e0fe85..30946ca95 100644 --- a/routes/api.php +++ b/routes/api.php @@ -24,8 +24,8 @@ // Keep in mind that prefix should be /api/v1. // Add ONE line to assign 5 resource routes to TaskController // Put one code line here below - Route::prefix('api/v1')->group(function () { - Route::apiResource('tasks', \App\Http\Controllers\TaskController::class); - }); + + Route::prefix('api/v1')->group(base_path('auth.php')); + Route::resource('tasks',TaskController::class); }); From c16e95fc26f6f38a8a90a3f8362ccf15bfe1bbd8 Mon Sep 17 00:00:00 2001 From: Emanuel Sige Date: Thu, 22 Aug 2024 05:21:36 +0300 Subject: [PATCH 4/5] routes --- routes/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api.php b/routes/api.php index 30946ca95..12aca984a 100644 --- a/routes/api.php +++ b/routes/api.php @@ -25,7 +25,7 @@ // Add ONE line to assign 5 resource routes to TaskController // Put one code line here below - Route::prefix('api/v1')->group(base_path('auth.php')); + Route::prefix('api/v1')->group(base_path('routes/auth.php')); Route::resource('tasks',TaskController::class); }); From 2838b1474ae6e118ba22f64fb599761447d93165 Mon Sep 17 00:00:00 2001 From: Emanuel Sige Date: Thu, 22 Aug 2024 05:51:45 +0300 Subject: [PATCH 5/5] tenaa api --- routes/api.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/routes/api.php b/routes/api.php index 12aca984a..4c8d61ae2 100644 --- a/routes/api.php +++ b/routes/api.php @@ -25,7 +25,6 @@ // Add ONE line to assign 5 resource routes to TaskController // Put one code line here below - Route::prefix('api/v1')->group(base_path('routes/auth.php')); - Route::resource('tasks',TaskController::class); - + Route::apiResource('/api/v1/tasks',TaskController::class); + });