Skip to content

Commit

Permalink
Revise routes
Browse files Browse the repository at this point in the history
  • Loading branch information
devNenyasha committed Sep 20, 2023
1 parent 6b551cb commit afec478
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@

// Task 1: point the main "/" URL to the HomeController method "index"
// Put one code line here below
Route::get('/', 'HomeController@index');
Route::get('/', [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}', 'UserController@index');
Route::get('/user/{name}', [UserController::class, 'show']);

// Task 3: point the GET URL "/about" to the view
// resources/views/pages/about.blade.php - without any controller
Expand All @@ -41,7 +41,7 @@
// 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 () {
Route::middleware(['auth'])->group(function () {
// Tasks inside that Authenticated group:

// Task 6: /app group within a group
Expand All @@ -54,32 +54,32 @@
// 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', 'DashboardController')->name('dashboard');
Route::get('/dashboard', [DashboardController::class, 'index'])->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('task', 'TaskController');
Route::resource('task', [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::group(['prefix' => 'admin', 'middleware' => 'is_admin'], function () {
Route::prefix('admin')->middleware(['is_admin'])->group(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', 'AdminDashboardController');
Route::get('/dashboard', [AdminDashboardController::class, 'index']);

// Task 11: point URL /admin/stats to a "Single Action" Admin/StatsController
// Put one code line here below
Route::get('/stats', 'Admin\StatsController');
Route::get('/stats', [Admin\StatsController::class, 'index']);

// End of the /admin Route Group
});
Expand Down

0 comments on commit afec478

Please sign in to comment.