diff --git a/app/Http/Livewire/Chat/PublicChat.php b/app/Http/Livewire/Chat/PublicChat.php index e87ed32..61f8d87 100644 --- a/app/Http/Livewire/Chat/PublicChat.php +++ b/app/Http/Livewire/Chat/PublicChat.php @@ -31,6 +31,8 @@ class PublicChat extends Component public string $paso = 'email'; // email | verificacion | registro | chat public string $email = ''; public string $nombreRegistro = ''; + public string $cedulaRegistro = ''; + public string $celularRegistro = ''; public string $codigoIngresado = ''; public ?string $emailMascarado = null; public ?int $contactIdPending = null; // contact.id mientras espera verificacion @@ -55,6 +57,8 @@ class PublicChat extends Component protected $rules = [ 'email' => 'required|email|max:100', 'nombreRegistro' => 'required|max:80', + 'cedulaRegistro' => 'nullable|max:20', + 'celularRegistro' => 'nullable|max:20', 'codigoIngresado' => 'nullable|digits:6', ]; @@ -95,14 +99,19 @@ class PublicChat extends Component public function crearCuenta(): void { $this->validate([ - 'email' => 'required|email|max:100', - 'nombreRegistro' => 'required|max:80', + 'email' => 'required|email|max:100', + 'nombreRegistro' => 'required|max:80', + 'cedulaRegistro' => 'nullable|max:20', + 'celularRegistro' => 'nullable|max:20', ]); $user = User::create([ 'name' => $this->nombreRegistro, 'email' => $this->email, - 'password' => \Illuminate\Support\Facades\Hash::make(\Illuminate\Support\Str::random(16)), + 'password' => Hash::make(Str::random(16)), + 'cedula' => $this->cedulaRegistro ?: null, + 'celular' => $this->celularRegistro ?: null, + 'estado' => 'activo', ]); $contact = ChatContact::create([ @@ -121,9 +130,11 @@ class PublicChat extends Component public function rechazarRegistro(): void { - $this->email = ''; - $this->nombreRegistro = ''; - $this->paso = 'email'; + $this->email = ''; + $this->nombreRegistro = ''; + $this->cedulaRegistro = ''; + $this->celularRegistro = ''; + $this->paso = 'email'; } // ───────────────────────────────────────────────────────── diff --git a/app/Models/User.php b/app/Models/User.php index 06c117e..5c20a41 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -29,6 +29,7 @@ class User extends Authenticatable 'parent_id', 'rank_id', + 'celular', ]; protected $hidden = [ diff --git a/resources/views/livewire/chat/public-chat.blade.php b/resources/views/livewire/chat/public-chat.blade.php index ef4726d..a9bac7c 100644 --- a/resources/views/livewire/chat/public-chat.blade.php +++ b/resources/views/livewire/chat/public-chat.blade.php @@ -58,13 +58,29 @@
- + @error('nombreRegistro') {{ $message }} @enderror
+
+ + + @error('cedulaRegistro') {{ $message }} @enderror +
+
+ + + @error('celularRegistro') {{ $message }} @enderror +