Route::get('user/{id}/profile', function ($id) { // })->name('profile'); $url = route('profile', ['id' => 1, 'photos' => 'yes']); // /user/1/profile?photos=yes
Route::pattern('id', '[0-9]+'); Route::get('user/{id}', function ($id) { // Only executed if {id} is numeric... });
use App\Http\Controllers\UserController; Route::get('/user', [UserController::class, 'index']);
Route::match(['get', 'post'], '/', function () { // }); Route::any('/', function () { // });
Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) { // });