Route::resource('planilla',ListaController::class); | Asignación automática de rutas |
Route::get('/user/profile', function () { // })->name('profile'); | Nombrar las rutas |
Route::get('/user/{id}', function ($id) { return 'User '.$id; }); Route::get('/posts/{post}/comments/{comment}', function ($postId, $commentId) { // }); | Paso de parametros |
Route::get('/user/{name?}', function ($name = null) { return $name; }); | Parámetros opcionales |
Route::get( '/user/profile', [UserProfileController::class, 'show'] )->name('profile'); | Rutas y controladores |
Route::get('/user/{id}/profile', function ($id) { //})->name('profile'); $url = route('profile', ['id' => 1]); | redirección |
use App\Http\Controllers\OrderController; Route::controller(OrderController::class)->group(function () { Route::get('/orders/{id}', 'show'); Route::post('/orders', 'store'); }); | Redireccion en base a parametros |