From c96ccfbe1b87e35bfd9dd9bb6ad24ef35d01665d Mon Sep 17 00:00:00 2001 From: nat Date: Tue, 28 Dec 2021 18:35:21 -0300 Subject: [PATCH] Usamos el slug en las rutas para editar y mostrar resultados de evento --- app/Http/Controllers/EventoController.php | 2 +- public/css/edit.css | 4 ++++ public/css/welcome.css | 2 +- resources/views/welcome.blade.php | 4 +++- routes/web.php | 4 ++-- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/EventoController.php b/app/Http/Controllers/EventoController.php index a1a0f9a..b5a880f 100644 --- a/app/Http/Controllers/EventoController.php +++ b/app/Http/Controllers/EventoController.php @@ -149,6 +149,6 @@ class EventoController extends Controller public function mostrarResultado(Request $request) { - return redirect()->route('show',['evento' => $request->id]); + return redirect()->route('show',['evento' => Evento::find($request->id)]); } } diff --git a/public/css/edit.css b/public/css/edit.css index 5a9880d..080acbb 100644 --- a/public/css/edit.css +++ b/public/css/edit.css @@ -66,3 +66,7 @@ button.cerrar { #fila-boton-enviar { display: block; } + +#enlace { + width: 95%; +} \ No newline at end of file diff --git a/public/css/welcome.css b/public/css/welcome.css index 241d29a..35d47cc 100644 --- a/public/css/welcome.css +++ b/public/css/welcome.css @@ -1,3 +1,3 @@ -label { +label, span.help { float: left; } diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index 6d9165d..d837ee8 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -48,7 +48,9 @@
- + +
+ Lo ideal es un nombre corto y fácil de recordar.
@csrf diff --git a/routes/web.php b/routes/web.php index 7f9e4d8..3194767 100644 --- a/routes/web.php +++ b/routes/web.php @@ -22,8 +22,8 @@ Route::post('/eventos', [EventoController::class, 'store'])->name('store'); Route::post('/eventos/{evento}', [EventoController::class, 'update'])->name('update'); -Route::get('/eventos/{evento}', [EventoController::class, 'edit'])->name('edit'); +Route::get('/eventos/{evento:slug}', [EventoController::class, 'edit'])->name('edit'); -Route::get('/eventos/{evento}/resultado', [EventoController::class, 'show'])->name('show'); +Route::get('/eventos/{evento:slug}/resultado', [EventoController::class, 'show'])->name('show'); Route::get('/resultado', [EventoController::class, 'mostrarResultado'])->name('resultado');