Created
May 7, 2025 11:54
-
-
Save kurotori/7e34fd44f47826d6012f6d353d8b3280 to your computer and use it in GitHub Desktop.
Laravel: Rutas y Vistas
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Document</title> | |
</head> | |
<body> | |
<form action="/usuario/preferencias" method="post"> | |
@csrf | |
<label for="nombre">Nombre:</label> | |
<input type="text" id="nombre" name="nombre"> | |
<button type="submit">Enviar</button> | |
</form> | |
</body> | |
</html> |
This file contains hidden or 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 | |
use Illuminate\Http\Request; | |
use Illuminate\Support\Facades\Route; | |
Route::get( | |
'/', | |
function () { | |
return view('welcome'); | |
} | |
); | |
Route::get( | |
'/prueba', | |
function(){ | |
echo("HOLA"); | |
} | |
); | |
Route::get( | |
'/dato/{dato}', | |
function($dato){ | |
echo("Se recibió: $dato"); | |
} | |
); | |
Route::get( | |
'usuario/{idUsuario}/mensaje/{idMensaje}', | |
function($idUsuario, $idMensaje){ | |
echo("ID Usuario: $idUsuario <br>"); | |
echo("ID Mensaje: $idMensaje <br>"); | |
} | |
); | |
Route::get( | |
'/formulario', | |
function () { | |
return view('formulario'); | |
} | |
); | |
Route::post( | |
'/usuario/preferencias', | |
function(Request $solicitud){ | |
$nombre = $solicitud->nombre; | |
echo("Preferencias del usuario: $nombre"); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment