Se adjuntan columnas de apellido paterno y materno para el usuario y validaciones de registro de usuario independiente
This commit is contained in:
@@ -16,28 +16,27 @@ class CreateNewUser implements CreatesNewUsers
|
||||
|
||||
public function create(array $input)
|
||||
{
|
||||
|
||||
if( $input['plantels'] == 0){
|
||||
throw ValidationException::withMessages([
|
||||
'plantels' => ['Debes elegir un plantel']
|
||||
]);
|
||||
}
|
||||
|
||||
Validator::make($input, [
|
||||
'name' => ['required', 'string', 'max:255'],
|
||||
'apellidoPaterno' => ['required', 'string', 'max:255'],
|
||||
'apellidoMaterno' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||
'telefono' => ['required', 'digits:10', 'unique:users,telefono'],
|
||||
'password' => $this->passwordRules(),
|
||||
'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '',
|
||||
])->validate();
|
||||
|
||||
|
||||
|
||||
if (User::where('email', $input['email'])
|
||||
->orWhere('telefono', $input['telefono'])
|
||||
->exists()) {
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'email' => ['El correo o teléfono ya están registrados.']
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
$user = User::create([
|
||||
'name' => $input['name'],
|
||||
'apellidoPaterno' => $input['apellidoPaterno'],
|
||||
'apellidoMaterno' => $input['apellidoMaterno'],
|
||||
'email' => $input['email'],
|
||||
'telefono' => $input['telefono'],
|
||||
'direccion' => "",
|
||||
@@ -59,8 +58,6 @@ class CreateNewUser implements CreatesNewUsers
|
||||
|
||||
$prospecto->prospectos()->sync([$user->id]);
|
||||
|
||||
|
||||
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ class UserController extends Controller
|
||||
|
||||
$user = User::create([
|
||||
'name' => $request->name,
|
||||
'apellidoPaterno' => $request-> apellidoPaterno,
|
||||
'apellidoMaterno' => $request-> apellidoMaterno,
|
||||
'email' => $request->email,
|
||||
'telefono' => $request->telefono ?? null,
|
||||
'direccion' => $request->direccion ?? null,
|
||||
|
||||
@@ -26,6 +26,8 @@ class User extends Authenticatable
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'apellidoPaterno',
|
||||
'apellidoMaterno',
|
||||
'email',
|
||||
'telefono',
|
||||
'direccion',
|
||||
|
||||
@@ -14,6 +14,8 @@ return new class extends Migration
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('apellidoPaterno');
|
||||
$table->string('apellidoMaterno');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('telefono',20)->nullable()->unique();
|
||||
|
||||
@@ -14,7 +14,9 @@ class UserSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
$user1= User::create([
|
||||
'name'=>'Luis Fernando Pérez',
|
||||
'name'=>'Luis Fernando',
|
||||
'apellidoPaterno'=>'Pérez',
|
||||
'apellidoMaterno'=>'Luna',
|
||||
'email'=>'fernandoestrp@outlook.es',
|
||||
'direccion'=>'Zacatenco mz 21 lt 2 san francisco cuautliquixca',
|
||||
'telefono'=>'5636287759',
|
||||
@@ -26,7 +28,9 @@ class UserSeeder extends Seeder
|
||||
$user1->plantelUsuarios()->sync(1);
|
||||
|
||||
$user2= User::create([
|
||||
'name'=>'Antonio Azulito Real Luna',
|
||||
'name'=>'Antonio Azulito',
|
||||
'apellidoPaterno'=>'Real',
|
||||
'apellidoMaterno'=>'Luna',
|
||||
'email'=>'reydelfin@gmail.com',
|
||||
'direccion'=>'Zacatenco mz 21 lt 2 san francisco cuautliquixca',
|
||||
'telefono'=>'5636287758',
|
||||
|
||||
@@ -37,14 +37,24 @@
|
||||
<select class="form-control" name="plantels" id="plantels" >
|
||||
<option value="0" >Selecciona un plantel</option>
|
||||
@foreach($plantels as $plantel)
|
||||
<option value="{{ $plantel->id }}">{{ $plantel->name }}</option>
|
||||
<option value="{{ $plantel->id }}" {{ old('plantels') == $plantel->id ? 'selected' : '' }}>{{ $plantel->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Nombre</label>
|
||||
<input type="name" class="form-control form-control-user" id="name" name="name" placeholder="Nombre" required autofocus autocomplete="name">
|
||||
<label>Nombres</label>
|
||||
<input type="text" class="form-control form-control-user" id="name" name="name" placeholder="Nombre" required autofocus value="{{ old('name') }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Apellido Paterno</label>
|
||||
<input type="text" class="form-control form-control-user" id="apellidoPaterno" name="apellidoPaterno" placeholder="Apellido Paterno" required autofocus value="{{ old('apellidoPaterno') }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Apellido Materno</label>
|
||||
<input type="text" class="form-control form-control-user" id="apellidoMaterno" name="apellidoMaterno" placeholder="Apellido Materno" required autofocus value="{{ old('apellidoMaterno') }}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -54,7 +64,7 @@
|
||||
|
||||
<div class="form-group">
|
||||
<label>Teléfono</label>
|
||||
<input type="text" class="form-control form-control-user" name="telefono" maxlength="10" onkeypress="return event.charCode >= 48 && event.charCode <= 57" inputmode="numeric" autocomplete="off" required>
|
||||
<input type="text" class="form-control form-control-user" name="telefono" maxlength="10" onkeypress="return event.charCode >= 48 && event.charCode <= 57" inputmode="numeric" value="{{ old('telefono') }}" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
<html lang="es">
|
||||
<head>
|
||||
@include('layouts._partials.head')
|
||||
@vite([ 'resources/js/app.js'])
|
||||
|
||||
{{-- @vite([ 'resources/js/app.js']) --}}
|
||||
|
||||
{{-- Livewire styles --}}
|
||||
@livewireStyles
|
||||
|
||||
@@ -21,6 +21,16 @@
|
||||
<input class="form-control" name="name">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="small mb-1">Apellido Paterno</label>
|
||||
<input class="form-control" name="apellidoPaterno">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="small mb-1">Apellido Materno</label>
|
||||
<input class="form-control" name="apellidoMaterno">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="small mb-1">Correo</label>
|
||||
<input class="form-control" name="email">
|
||||
|
||||
@@ -27,6 +27,16 @@
|
||||
<input class="form-control" name="name" value="{{$user->name}}">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="small mb-1">Apellido Paterno</label>
|
||||
<input class="form-control" name="apellidoPaterno" value="{{$user->apellidoPaterno}}">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="small mb-1">Apellido Materno</label>
|
||||
<input class="form-control" name="apellidoMaterno" value="{{$user->apellidoMaterno}}">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="small mb-1">Correo</label>
|
||||
<input class="form-control" name="email" value="{{$user->email}}">
|
||||
|
||||
+6
-10
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use App\Models\Conversation;
|
||||
use App\Models\Conversation;
|
||||
|
||||
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
@@ -10,12 +9,9 @@ Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||
Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {
|
||||
|
||||
return Conversation::where('id', $conversationId)
|
||||
->whereHas('users', fn ($q) =>
|
||||
$q->where('user_id', $user->id)
|
||||
)->exists();
|
||||
->whereHas('users', function ($q) use ($user) {
|
||||
$q->where('user_id', $user->id);
|
||||
})
|
||||
->exists();
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Broadcast::channel('chat.{conversationId}', function ($user, $conversationId) {return Conversation::where('id', $conversationId)->whereHas('users', function ($q) use ($user) {$q->where('user_id', $user->id);})->exists();});
|
||||
|
||||
Reference in New Issue
Block a user