diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index a3b53ff..57112b5 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -22,7 +22,7 @@ class CreateNewUser implements CreatesNewUsers public function create(array $input) { Validator::make($input, [ - //'name' => ['required', 'string', 'max:255'], + 'nombre_per' => ['required', 'string', 'max:255'], 'email' => [ 'required', 'string', @@ -33,13 +33,18 @@ public function create(array $input) 'username' => ['required', 'string', 'max:20'], 'password' => $this->passwordRules(), ])->validate(); - //TODO: Terminar esto de las personas + + $persona = Persona::create([ + 'nombre_per' => $input['nombre_per'], + ]); + return User::create([ - //'name' => $input['name'], 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), - 'rol' => 1, + 'rol' => 2, + 'id_persona' => $persona->id_persona ]); + } } diff --git a/database/migrations/2022_09_22_152240_create_personas.php b/database/migrations/2022_09_22_152240_create_personas.php index d20801c..a03dac3 100644 --- a/database/migrations/2022_09_22_152240_create_personas.php +++ b/database/migrations/2022_09_22_152240_create_personas.php @@ -15,15 +15,15 @@ public function up() { Schema::create('personas', function (Blueprint $table) { $table->Increments('id_persona'); - $table->string('nombre_per'); - $table->string('apellido_pa_per'); - $table->string('apellido_ma_per'); - $table->integer('ci_per'); - $table->integer('cel_per'); - $table->string('num_seguro'); - $table->boolean('donante'); - $table->date('fecha_nac'); - $table->Integer('id_tipo_sangre')->unsigned(); + $table->string('nombre_per')->nullable(); + $table->string('apellido_pa_per')->nullable(); + $table->string('apellido_ma_per')->nullable(); + $table->integer('ci_per')->nullable(); + $table->integer('cel_per')->nullable(); + $table->string('num_seguro')->nullable(); + $table->boolean('donante')->nullable(); + $table->date('fecha_nac')->nullable(); + $table->Integer('id_tipo_sangre')->unsigned()->nullable()->default(1); $table->foreign('id_tipo_sangre')->references('id_tipo_sangre')->on('tipos_sangre'); $table->timestamps(); }); diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index af9307d..e4928be 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -17,7 +17,7 @@ class DatabaseSeeder extends Seeder public function run() { $this->call([ - TipoSangre::class, + TipoSangreSeeder::class, SedeSeeder::class, TipoPatologiaSeeder::class, EspecialidadSeeder::class diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 65f5c67..c15ed4e 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -13,6 +13,13 @@ class="absolute inset-0 bg-gradient-to-r from-blue-300 to-blue-600 shadow-lg tra