Last active
December 3, 2022 09:08
-
-
Save frikishaan/447fac5cf1224b6661e66f910b752710 to your computer and use it in GitHub Desktop.
How to Generate Routes with Name and Route Prefix?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
... | |
Route::prefix('/users')->middleware(['auth'])->name('users.')->group(function (){ | |
Route::get('', function(){ | |
return "Users"; | |
})->name('index'); // Will generate Route ('/users') with name ('users.index') | |
Route::get('/edit', function(){ | |
return "Users Edit"; | |
})->name('edit'); // Will generate Route ('/users/edit') with name ('users.edit') | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment