mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
36 lines
900 B
PHP
Executable File
36 lines
900 B
PHP
Executable File
<?php
|
|
namespace App\Entities\Clientes;
|
|
|
|
use App\Models\Clientes\ClienteModel;
|
|
use CodeIgniter\Entity;
|
|
|
|
class ClienteContactoEntity extends \CodeIgniter\Entity\Entity
|
|
{
|
|
protected $attributes = [
|
|
"id" => null,
|
|
"cliente_id" => null,
|
|
"cargo" => null,
|
|
"nombre" => null,
|
|
"apellidos" => null,
|
|
"telefono" => null,
|
|
"email" => null,
|
|
"is_deleted" => 0,
|
|
"created_at" => null,
|
|
"updated_at" => null,
|
|
];
|
|
protected $casts = [
|
|
"cliente_id" => "int",
|
|
"is_deleted" => "int",
|
|
];
|
|
|
|
public function getFullName() : string
|
|
{
|
|
return trim(implode(" ",[$this->attributes['nombre'] ?? '',$this->attributes["apellidos"] ?? '']));
|
|
}
|
|
public function cliente() : ?ClienteEntity
|
|
{
|
|
$cm = model(ClienteModel::class);
|
|
return $cm->find($this->attributes["cliente_id"]);
|
|
}
|
|
}
|