What is the correct way to attach a controller method to a specific route? code example
Example 1: laravel route controller
use App\Http\Controllers\UserController;
Route::get('user/{id}', [UserController::class, 'show']);
Example 2: laravel 8 routes namespace
Route::group(['namespace' => 'App\Http\Controllers', 'prefix' => 'admin',
'as' => 'admin.', 'middleware' => ['auth:sanctum', 'verified']], function()
{
Route::get('/dashboard', ['DashboardController', 'index']);
});