Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kurotori/7e34fd44f47826d6012f6d353d8b3280 to your computer and use it in GitHub Desktop.
Save kurotori/7e34fd44f47826d6012f6d353d8b3280 to your computer and use it in GitHub Desktop.
Laravel: Rutas y Vistas
<!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>
<?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