The action function generates a URL for the given controller action
$url = action('HomeController@index');
Route::get('/x/{user?}', 'HomeController@index');
Route::get('/xxxxxxx', 'HomeController@index');
@dd(
action('HomeController@index'),
action('HomeController@index',['im_a_guest']),
)
/*
"http://laravel.local/xxxxxxx"
"http://laravel.local/xxxxxxx/im_a_guest"
*/