1//accessing any function in the controller (this is web.php file)
2use App\Http\Controllers\PostsController;
3
4Route::get('/post', 'App\Http\Controllers\PostsController@index');
1Uncomment this line in app>>provider>>RouteServiceProvider.php file
2// protected $namespace = 'App\\Http\\Controllers';
1use App\Http\Controllers\UserController;
2
3Route::get('/users', [UserController::class, 'index']);
4// or
5Route::get('/users', 'App\Http\Controllers\UserController@index');
6
1use App\Http\Controllers\RegistrationController;
2
3Route::get('/', [RegistrationController::class, 'create']);
4