1Route::prefix('admin')->group(function () {
2 Route::get('/users', function () {
3 // Matches The "/admin/users" URL
4 });
5});
1Route::name('admin.')->group(function () {
2 Route::get('/users', function () {
3 // Route assigned name "admin.users"...
4 })->name('users');
5});
1 Route::group(['namespace' => 'App\Http\Controllers', 'prefix' => 'admin',
2 'as' => 'admin.', 'middleware' => ['auth:sanctum', 'verified']], function()
3{
4 Route::get('/dashboard', ['DashboardController', 'index']);
5});
1Route::namespace('Admin')->group(function () {
2 // Controllers Within The "App\Http\Controllers\Admin" Namespace
3});
1Route::get('/user/{name?}', function ($name = null) {
2 return $name;
3});
4
5Route::get('/user/{name?}', function ($name = 'John') {
6 return $name;
7});
1use App\Models\User;
2
3Route::get('/users/{user}', function (User $user) {
4 return $user->email;
5});