mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
trabajando en user y groups con el nuevo formato
This commit is contained in:
64
ci4/app/Entities/Usuarios/UserEntity.php
Normal file
64
ci4/app/Entities/Usuarios/UserEntity.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace App\Entities\Usuarios;
|
||||
|
||||
use CodeIgniter\Entity;
|
||||
|
||||
class UserEntity extends \CodeIgniter\Entity\Entity
|
||||
{
|
||||
protected $attributes = [
|
||||
"id_user" => null,
|
||||
"group" => null,
|
||||
"first_name" => null,
|
||||
"last_name" => null,
|
||||
"date_birth" => null,
|
||||
"address" => null,
|
||||
"city" => null,
|
||||
"state" => null,
|
||||
"country" => null,
|
||||
"zip_code" => null,
|
||||
"mobile" => null,
|
||||
"email" => null,
|
||||
"password" => null,
|
||||
"last_ip" => null,
|
||||
"last_access" => null,
|
||||
"picture" => "/assets/img/default-user.png",
|
||||
"language" => null,
|
||||
"tfa" => false,
|
||||
"tfa_secret" => null,
|
||||
"tfa_code" => null,
|
||||
"blocked" => null,
|
||||
"email_confirmed" => 0,
|
||||
"token" => null,
|
||||
"status" => false,
|
||||
"created_at" => null,
|
||||
"updated_at" => null,
|
||||
];
|
||||
protected $casts = [
|
||||
"tfa" => "boolean",
|
||||
"email_confirmed" => "int",
|
||||
"status" => "boolean",
|
||||
];
|
||||
/**
|
||||
* Returns a full name: "first last"
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFullName()
|
||||
{
|
||||
$fullName =
|
||||
(!empty($this->attributes["first_name"]) ? trim($this->attributes["first_name"]) . " " : "") .
|
||||
(!empty($this->attributes["last_name"]) ? trim($this->attributes["last_name"]) : "");
|
||||
$name = empty($fullName) ? $this->attributes["username"] : $fullName;
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for getFullName()
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fullName()
|
||||
{
|
||||
return $this->getFullName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user