Agregue unique a email y errores a register.

Y MERGE LO DE BRYAM (COPIE Y PEGUE)
This commit is contained in:
2025-08-20 01:05:36 -03:00
parent 7c0313bc49
commit 01baa66213
4 changed files with 115 additions and 91 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ class RegisterController extends Controller
{ {
$userData = $request->validate([ $userData = $request->validate([
'name' => ['required', 'string'], 'name' => ['required', 'string'],
'email' => ['required', 'email'], 'email' => ['required', 'email', 'unique:users,email'],
'password' => ['required', 'confirmed'] 'password' => ['required', 'confirmed']
]); ]);
+38 -15
View File
@@ -1,46 +1,69 @@
{{-- @vite('resources/css/app.css') --}} @props(['auth' => false])
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script> <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<title>{{ $title ?? 'Lauck - Home' }}</title> <title>{{ $title ?? 'Lauck - Home' }}</title>
</head> </head>
<body class="bg-neutral-900 relative pb-50 min-h-screen"> <body class="bg-neutral-900 relative pb-50 min-h-screen">
<nav class="bg-white border-gray-200 dark:bg-gray-900"> <nav class="bg-white border-gray-200 dark:bg-gray-900">
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4"> <div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<a href="https://flowbite.com/" class="flex items-center space-x-3 rtl:space-x-reverse"> <a href="https://flowbite.com/" class="flex items-center space-x-3 rtl:space-x-reverse">
<img src="https://flowbite.com/docs/images/logo.svg" class="h-8" alt="Flowbite Logo" /> <img src="https://flowbite.com/docs/images/logo.svg" class="h-8" alt="Flowbite Logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">{{ $navTitle ?? 'Lauck Home' }}</span> <span
class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">{{ $navTitle ?? 'Lauck Home' }}</span>
</a> </a>
<button data-collapse-toggle="navbar-default" type="button" class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-default" aria-expanded="false"> <button data-collapse-toggle="navbar-default" type="button"
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
aria-controls="navbar-default" aria-expanded="false">
<span class="sr-only">Open main menu</span> <span class="sr-only">Open main menu</span>
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14"> <svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none"
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1h15M1 7h15M1 13h15" /> viewBox="0 0 17 14">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M1 1h15M1 7h15M1 13h15" />
</svg> </svg>
</button> </button>
<div class="hidden w-full md:block md:w-auto" id="navbar-default"> <div class="hidden w-full md:block md:w-auto" id="navbar-default">
<ul class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700"> @if ($auth)
<ul
class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li> <li>
<a href="{{route('dashboard')}}" class="block py-2 px-3 text-white bg-blue-700 rounded-sm md:bg-transparent md:text-blue-700 md:p-0 dark:text-white md:dark:text-blue-500" aria-current="page">Home</a> <a href="{{ route('dashboard') }}"
class="block py-2 px-3 text-white bg-blue-700 rounded-sm md:bg-transparent md:text-blue-700 md:p-0 dark:text-white md:dark:text-blue-500">Home</a>
</li> </li>
<li> <li>
<a href="{{route('productos.index')}}" class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Productos</a> <a href="{{ route('productos.index') }}"
class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Productos</a>
</li> </li>
<li> <li>
<a href="#" class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Services</a> <a href="#"
class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Services</a>
</li> </li>
<li> <li>
<a href="#" class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Pricing</a> <a href="#"
class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Pricing</a>
</li> </li>
<li> <li>
<a href="#" class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Contact</a> <a href="#"
class="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Contact</a>
</li> </li>
</ul> </ul>
@else
<ul
class="font-medium flex flex-col p-4 md:p-0 mt-4 border border-gray-100 rounded-lg bg-gray-50 md:flex-row md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
<li>
<a href="{{ route('register') }}"
class="block py-2 px-3 dark:hover:bg-gray-700 dark:hover:text-white text-gray-900 rounded-sm hover:bg-gray-100 dark:text-white md:px-4 md:py-2 md:rounded-md md:text-white md:font-semibold md:bg-stone-500 md:hover:scale-105 transition">Registrate</a>
</li>
<li>
<a href="{{route('login')}}"
class="block py-2 px-3 dark:hover:bg-gray-700 dark:hover:text-white text-gray-900 rounded-sm hover:bg-gray-100 dark:text-white md:px-4 md:py-2 md:rounded-md md:text-white md:font-semibold md:bg-stone-500 md:hover:scale-105 transition">Iniciar Sesion</a>
</li>
</ul>
@endif
</div> </div>
</div> </div>
</nav> </nav>
@@ -52,7 +75,8 @@
<img src="https://flowbite.com/docs/images/logo.svg" class="h-8" alt="Flowbite Logo" /> <img src="https://flowbite.com/docs/images/logo.svg" class="h-8" alt="Flowbite Logo" />
<span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span> <span class="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">Flowbite</span>
</a> </a>
<ul class="flex flex-wrap items-center mb-6 text-sm font-medium text-gray-500 sm:mb-0 dark:text-gray-400"> <ul
class="flex flex-wrap items-center mb-6 text-sm font-medium text-gray-500 sm:mb-0 dark:text-gray-400">
<li> <li>
<a href="#" class="hover:underline me-4 md:me-6">About</a> <a href="#" class="hover:underline me-4 md:me-6">About</a>
</li> </li>
@@ -73,5 +97,4 @@
</div> </div>
</footer> </footer>
</body> </body>
</html> </html>
+22 -5
View File
@@ -1,11 +1,13 @@
<!doctype html> <!doctype html>
<html> <html>
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bicicletería Lauck - Registro</title> <title>Bicicletería Lauck - Registro</title>
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
</head> </head>
<body class="bg-gradient-to-br from-blue-500 to-blue-700 flex items-center justify-center min-h-screen px-4"> <body class="bg-gradient-to-br from-blue-500 to-blue-700 flex items-center justify-center min-h-screen px-4">
<div class="flex flex-col items-center space-y-6 w-full max-w-lg"> <div class="flex flex-col items-center space-y-6 w-full max-w-lg">
@@ -21,28 +23,42 @@
<form action="{{ route('register.store') }}" method="post" class="space-y-5"> <form action="{{ route('register.store') }}" method="post" class="space-y-5">
@csrf @csrf
@if ($errors->any())
<div>
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div> <div>
<label class="block text-sm font-medium text-gray-700 mb-1">Nombre completo</label> <label class="block text-sm font-medium text-gray-700 mb-1">Nombre completo</label>
<input type="text" name="name" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400"> <input type="text" name="name" required
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
</div> </div>
<div> <div>
<label class="block text-sm font-medium text-gray-700 mb-1">Correo electrónico</label> <label class="block text-sm font-medium text-gray-700 mb-1">Correo electrónico</label>
<input type="email" name="email" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400"> <input type="email" name="email" required
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
</div> </div>
<div> <div>
<label class="block text-sm font-medium text-gray-700 mb-1">Contraseña</label> <label class="block text-sm font-medium text-gray-700 mb-1">Contraseña</label>
<input type="password" name="password" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400"> <input type="password" name="password" required
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
</div> </div>
<div> <div>
<label class="block text-sm font-medium text-gray-700 mb-1">Confirmar contraseña</label> <label class="block text-sm font-medium text-gray-700 mb-1">Confirmar contraseña</label>
<input type="password" name="password_confirmation" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400"> <input type="password" name="password_confirmation" required
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
</div> </div>
<div> <div>
<input type="submit" name="submit" value="Registrarse" class="w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700 transition-colors"> <input type="submit" name="submit" value="Registrarse"
class="w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700 transition-colors">
</div> </div>
<p class="text-center text-sm text-gray-600"> <p class="text-center text-sm text-gray-600">
@@ -53,4 +69,5 @@
</div> </div>
</body> </body>
</html> </html>
+4 -20
View File
@@ -1,20 +1,4 @@
<!DOCTYPE html> <x-appc>
<html lang="en"> <x-slot name="title">Lauck - Inicio</x-slot>
<head> <x-slot name="navTitle">Bienvenido</x-slot>
<meta charset="UTF-8"> </x-appc>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<title>Laravel 12</title>
</head>
<body>
<div class="h-screen w-screen bg-amber-200">
<div class="w-full h-15 bg-red-800/40 flex items-center px-4">
<h1 class="font-bold text-3xl">Homepage</h1>
<div class="ml-auto flex gap-4">
<a href="login" class="hover:underline">Iniciar sesión</a>
<a href="register" class="hover:underline">Registrarse</a>
</div>
</div>
</div>
</body>
</html>