Nick Stauner
0
Q:

prefix laravel route

Route::get('user/{id}/profile', function ($id) {
    //
})->name('profile');

$url = route('profile', ['id' => 1, 'photos' => 'yes']);

// /user/1/profile?photos=yes
2
Route::pattern('id', '[0-9]+');
Route::get('user/{id}', function ($id) {
    // Only executed if {id} is numeric...
});
2
use App\Http\Controllers\UserController;

Route::get('/user', [UserController::class, 'index']);
1
Route::match(['get', 'post'], '/', function () {
    //
});

Route::any('/', function () {
    //
});
1
Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
    //
});
0

New to Communities?

Join the community