Terminada gestion de contraseñas de usuarios en perfil y zona admin

This commit is contained in:
imnavajas
2024-07-16 09:26:03 +02:00
parent ad266dd14f
commit 944f92f3b0
14 changed files with 39 additions and 1655 deletions

View File

@ -1,7 +1,6 @@
<?php
namespace App\Entities\Usuarios;
use CodeIgniter\Entity;
use CodeIgniter\Shield\Entities\User;
class UsersEntity extends User
@ -13,4 +12,17 @@ class UsersEntity extends User
protected $casts = [
];
public function getFullName()
{
$firstName = trim($this->attributes["first_name"] ?? "");
$lastName = trim($this->attributes["last_name"] ?? "");
$fullName = $firstName . ' ' . $lastName;
$fullName = trim($fullName); // In case first name is empty, this will remove the leading space
// Use the username attribute if the full name is still empty after trimming
return $fullName ?: $this->attributes["username"];
}
}