From d87f0b5ac20e66fe24516a21c78780169fb76621 Mon Sep 17 00:00:00 2001 From: "Md. Elias Shikdar" <82110741+Elias339@users.noreply.github.com> Date: Mon, 25 Nov 2024 23:22:16 +0600 Subject: [PATCH 1/4] Update api.php --- routes/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/api.php b/routes/api.php index 39ecc07c6..da6453cb3 100644 --- a/routes/api.php +++ b/routes/api.php @@ -22,6 +22,6 @@ // Task 12: Manage tasks with endpoint /api/v1/tasks/*****. // 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::apiResource('/v1/tasks', App\Http\Controllers\TaskController::class); }); From 01e5497ebf5b2dcd18298dcd1eceafbe4f5150f0 Mon Sep 17 00:00:00 2001 From: "Md. Elias Shikdar" <82110741+Elias339@users.noreply.github.com> Date: Mon, 25 Nov 2024 23:24:12 +0600 Subject: [PATCH 2/4] Update web.php --- routes/web.php | 51 ++++++++++++++++---------------------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/routes/web.php b/routes/web.php index 15508ce8d..adeffd314 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,70 +14,51 @@ */ // Task 1: point the main "/" URL to the HomeController method "index" -// Put one code line here below - +Route::get('/', [App\Http\Controllers\HomeController::class, 'index']); // Task 2: point the GET URL "/user/[name]" to the UserController method "show" // It doesn't use Route Model Binding, it expects $name as a parameter -// Put one code line here below - +Route::get('/user/{name}', [App\Http\Controllers\UserController::class, 'show']); -// Task 3: point the GET URL "/about" to the view -// resources/views/pages/about.blade.php - without any controller +// Task 3: point the GET URL "/about" to the view resources/views/pages/about.blade.php - without any controller // Also, assign the route name "about" -// Put one code line here below - +Route::view('/about', 'pages.about')->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 - - // Tasks inside that Authenticated group: - +Route::group(['middleware' => 'auth'], function () { + // Task 6: /app group within a group // Add another group for routes with prefix "app" - // Put one Route Group code line here below - - // Tasks inside that /app group: - + Route::group(['prefix' => 'app'], function () { // 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::get('/dashboard', App\Http\Controllers\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 - - // End of the /app Route Group + Route::resource('/tasks', App\Http\Controllers\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 - - - // Tasks inside that /admin group: - + Route::group(['prefix' => 'admin', 'middleware' => 'is_admin'], function () { // 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); // 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 /admin Route Group - -// End of the main Authenticated Route Group +}); // End of the main Authenticated Route Group // One more task is in routes/api.php - require __DIR__.'/auth.php'; From 926f79a17bbbca6bd95acac81f17e89ea25097e9 Mon Sep 17 00:00:00 2001 From: "Md. Elias Shikdar" <82110741+Elias339@users.noreply.github.com> Date: Mon, 25 Nov 2024 23:40:09 +0600 Subject: [PATCH 3/4] Update web.php --- routes/web.php | 36 +++++------------------------------- 1 file changed, 5 insertions(+), 31 deletions(-) diff --git a/routes/web.php b/routes/web.php index adeffd314..e507ce422 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,7 @@ name('about'); -// Task 4: redirect the GET URL "log-in" to a URL "login" Route::redirect('/log-in', '/login'); - -// Task 5: group the following route sentences below in Route::group() -// Assign middleware "auth" Route::group(['middleware' => 'auth'], function () { - - // Task 6: /app group within a group - // Add another group for routes with prefix "app" Route::group(['prefix' => 'app'], function () { - - // Task 7: point URL /app/dashboard to a "Single Action" DashboardController - // Assign the route name "dashboard" Route::get('/dashboard', App\Http\Controllers\DashboardController::class)->name('dashboard'); + Route::resource('/tasks', TaskController::class); + }); - // Task 8: Manage tasks with URL /app/tasks/***. - // Add ONE line to assign 7 resource routes to TaskController - Route::resource('/tasks', App\Http\Controllers\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 Route::group(['prefix' => 'admin', 'middleware' => 'is_admin'], function () { - - // Task 10: point URL /admin/dashboard to a "Single Action" Admin/DashboardController Route::get('/dashboard', App\Http\Controllers\Admin\DashboardController::class); - - // Task 11: point URL /admin/stats to a "Single Action" Admin/StatsController 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'; From 1b0983db8547c018a96e5321edf31978c809b284 Mon Sep 17 00:00:00 2001 From: "Md. Elias Shikdar" <82110741+Elias339@users.noreply.github.com> Date: Mon, 25 Nov 2024 23:41:57 +0600 Subject: [PATCH 4/4] Update api.php --- routes/api.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/routes/api.php b/routes/api.php index da6453cb3..b1da9e6d5 100644 --- a/routes/api.php +++ b/routes/api.php @@ -2,6 +2,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; +use App\Http\Controllers\Api\V1; /* |-------------------------------------------------------------------------- @@ -19,9 +20,7 @@ }); Route::group(['middleware' => 'auth:sanctum'], function() { - // Task 12: Manage tasks with endpoint /api/v1/tasks/*****. - // Keep in mind that prefix should be /api/v1. - // Add ONE line to assign 5 resource routes to TaskController - Route::apiResource('/v1/tasks', App\Http\Controllers\TaskController::class); - + Route::prefix('/v1')->group(function () { + Route::resource('tasks', V1\TaskController::class); + }); });