From cc3684d23bfb26ad05d2a76ea7ec165f4dfcc254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mois=C3=A9s=20de=20Jes=C3=BAs=20Cort=C3=A9s=20Castellanos?= Date: Thu, 19 Dec 2024 16:35:46 -0600 Subject: [PATCH] =?UTF-8?q?UPDATE:=20Correcciones=20visuales=20en=20admini?= =?UTF-8?q?straci=C3=B3n=20usuarios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/User.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/app/Models/User.php b/app/Models/User.php index 2d8f300..f32efdd 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -5,6 +5,7 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use App\Http\Traits\HasProfilePhoto; +use Illuminate\Database\Eloquent\Casts\Attribute; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; @@ -62,6 +63,28 @@ protected function casts(): array * Los accesores a aƱadir al modelo en su forma de array */ protected $appends = [ + 'full_name', + 'last_name', 'profile_photo_url', ]; + + /** + * Nombre completo del usuario + */ + public function fullName(): Attribute + { + return Attribute::make( + get: fn () => $this->name . ' ' . $this->paternal . ' ' . $this->maternal, + ); + } + + /** + * Apellido paterno y materno del usuario + */ + public function lastName(): Attribute + { + return Attribute::make( + get: fn () => $this->paternal . ' ' . $this->maternal, + ); + } }