From 36c368dad34184cc6f396446478deded6cef062c Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 7 Mar 2026 12:19:23 -0600 Subject: [PATCH] =?UTF-8?q?Modificaci=C3=B3n=20de=20texto=20por=20defecto?= =?UTF-8?q?=20en=20mayusculas=20para=20creaci=C3=B3n=20de=20usuarios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Actions/Fortify/CreateNewUser.php | 6 ++--- app/Http/Controllers/UserController.php | 6 ++--- app/Models/User.php | 32 +++++++++++++++++++++---- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index f39acb92..58dde31d 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -34,9 +34,9 @@ class CreateNewUser implements CreatesNewUsers ])->validate(); $user = User::create([ - 'name' => $input['name'], - 'apellidoPaterno' => $input['apellidoPaterno'], - 'apellidoMaterno' => $input['apellidoMaterno'], + 'name' => mb_strtoupper($input['name'], 'UTF-8'), + 'apellidoPaterno' => mb_strtoupper($input['apellidoPaterno'], 'UTF-8'), + 'apellidoMaterno' => mb_strtoupper($input['apellidoMaterno'], 'UTF-8'), 'email' => $input['email'], 'telefono' => $input['telefono'], 'direccion' => "", diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 9b863339..f54e4959 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -43,9 +43,9 @@ class UserController extends Controller $passwordTemporal = Str::random(12); $user = User::create([ - 'name' => $request->name, - 'apellidoPaterno' => $request-> apellidoPaterno, - 'apellidoMaterno' => $request-> apellidoMaterno, + 'name' => mb_strtoupper($request->name, 'UTF-8'), + 'apellidoPaterno' => mb_strtoupper($request->apellidoPaterno, 'UTF-8'), + 'apellidoMaterno' => mb_strtoupper($request->apellidoMaterno, 'UTF-8'), 'email' => $request->email, 'telefono' => $request->telefono ?? null, 'direccion' => $request->direccion ?? null, diff --git a/app/Models/User.php b/app/Models/User.php index 09163668..e0248de6 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -3,15 +3,16 @@ namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; -use Laravel\Sanctum\HasApiTokens; -use Laravel\Jetstream\HasProfilePhoto; -use Spatie\Permission\Traits\HasRoles; -use Illuminate\Notifications\Notifiable; -use Laravel\Fortify\TwoFactorAuthenticatable; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Notifications\Notifiable; +use Laravel\Fortify\TwoFactorAuthenticatable; +use Laravel\Jetstream\HasProfilePhoto; +use Laravel\Sanctum\HasApiTokens; +use Spatie\Permission\Traits\HasRoles; class User extends Authenticatable { @@ -59,6 +60,27 @@ class User extends Authenticatable ]; } + protected function name(): Attribute + { + return Attribute::make( + set: fn ($value) => strtoupper($value) + ); + } + + protected function apellidoPaterno(): Attribute + { + return Attribute::make( + set: fn ($value) => strtoupper($value) + ); + } + + protected function apellidoMaterno(): Attribute + { + return Attribute::make( + set: fn ($value) => strtoupper($value) + ); + } + // public function note() : HasOne // {