Slashes in Laravel Routes

28 Views Asked by At

I'm new to Laravel and was wondering what is the significance and meaning of using forward slashes in routes? For example:

Route::get('/welcome', 'MyController@welcome');

I get the same result with:

Route::get('welcome', 'MyController@welcome');

So what is the difference? Is the forward slash at the beginning always optional, or is it necessary sometimes?

Also, can multiple forward slashes be used, e.g.:

Route::get('/welcome/to/this/subpath', 'MyController@welcome');

Just trying to learn. Thanks for your insights.

0

There are 0 best solutions below