route with class code example
Example 1: laravel route optional parameter
Route::get('/sample/{param?}', 'SampleController@index');
Example 2: laravel route
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');
Route::get('/sample/{param?}', 'SampleController@index');
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');