-- namespaces are not a thing of the past. They remain crucial for organizing code, preventing naming conflicts, and promoting modularity. Use Route::namespace() to apply namespaces to route groups, avoiding repetitive full class paths
-- while Route::resource() isn't explicitly mentioned in the Laravel 10 docs, it's still functional and respects namespaces. It automatically prepends the namespace from the route group to the controller class
-- for normal routes (not resource routes), you'll need to specify the full class name with its namespace. This ensures the controller is correctly resolved
-- Group related controllers within namespaces based on functionality or features. Apply Route::namespace() to groups of routes sharing the same namespace. Include the namespace for clarity and to avoid potential errors. If using IDE auto-completion or avoiding manual namespace repetition, import classes using use statements. For extensive routes, explore packages like laravel-controllers for automatic route registration based on conventions
Route::middleware(['auth', 'can:access shp'])->name('shp.')->prefix('shp')->namespace('App\Http\Controllers\SHP')->group(function () {
Route::get('/', 'DashboardController@index')->name('dashboard');
});