xxxxxxxxxx
Route::get('/users', [UserController::class, 'index']);
xxxxxxxxxx
public function boot()
{
Route::prefix('api')
->middleware('api')
->namespace('App\Http\Controllers') // <---------
->group(base_path('routes/api.php'));
}
xxxxxxxxxx
Uncomment "protected $namespace = 'App\\Http\\Controllers';" line in "RouteServiceProvider.php" file and you should be good.