Estructura de base de datos, migraciones, factories y seeders

This commit is contained in:
Lucho
2026-06-24 16:28:01 -03:00
parent 317d85b5c3
commit c81120f2e3
42 changed files with 1033 additions and 298 deletions
+13 -1
View File
@@ -6,6 +6,7 @@ use App\Models\Cliente;
use App\Models\CredencialCliente;
use App\Models\Persona;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Cliente>
@@ -30,8 +31,19 @@ class ClienteFactory extends Factory
'dni' => (string) $this->faker->unique()->numberBetween(20000000, 45000000),
'correo' => $this->faker->unique()->safeEmail(),
'persona_id' => Persona::factory(),
'baja_id' => null,
'baja_id' => 1,
'credencialcliente_id' => CredencialCliente::factory(),
];
}
public function configure(): static
{
return $this->afterCreating(function (Cliente $cliente) {
CredencialCliente::where('id', $cliente->credencialcliente_id)
->update([
'correo' => $cliente->correo,
'contra' => Hash::make($cliente->dni),
]);
});
}
}