Answers for "option parameter in route laravel"

PHP
0

laravel route optional parameter

// You can make a parameter optional by placing a '?' after the parameter name.
// Make sure to give the route's corresponding variable a default value:
Route::get('user/{name?}', function ($name = null) {
    return $name;
});

Route::get('user/{name?}', function ($name = 'John') {
    return $name;
});
Posted by: Guest on February-16-2021
0

laravel route optional parameters

Route::get('user/{name?}', function ($name = null) {
    return $name;
});

Route::get('user/{name?}', function ($name = 'John') {
    return $name;
});
Posted by: Guest on July-24-2021

Code answers related to "option parameter in route laravel"

Browse Popular Code Answers by Language