47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
![]() |
<?php
|
||
|
namespace Incoviba\Model\Venta;
|
||
|
|
||
|
use Incoviba\Common\Ideal\Model;
|
||
|
use Incoviba\Model\Direccion;
|
||
|
|
||
|
class Propietario extends Model
|
||
|
{
|
||
|
public int $rut;
|
||
|
public string $dv;
|
||
|
public string $nombres;
|
||
|
public array $apellidos;
|
||
|
public Datos $datos;
|
||
|
public ?Propietario $representante;
|
||
|
public ?bool $otro;
|
||
|
|
||
|
public function rut(): string
|
||
|
{
|
||
|
return implode('-', [
|
||
|
number_format($this->rut, 0, ',', '.'),
|
||
|
$this->dv
|
||
|
]);
|
||
|
}
|
||
|
public function nombreCompleto(): string
|
||
|
{
|
||
|
return implode(' ', [
|
||
|
$this->nombres,
|
||
|
implode(' ', $this->apellidos)
|
||
|
]);
|
||
|
}
|
||
|
|
||
|
public function jsonSerialize(): mixed
|
||
|
{
|
||
|
return array_merge([
|
||
|
'rut' => $this->rut,
|
||
|
'dv' => $this->dv,
|
||
|
'rut_formateado' => $this->rut(),
|
||
|
'nombres' => $this->nombres,
|
||
|
'apellidos' => $this->apellidos,
|
||
|
'nombre_completo' => $this->nombreCompleto(),
|
||
|
], $this->datos->jsonSerialize(), [
|
||
|
'representante' => $this->representante ?? '',
|
||
|
'otro' => $this->otro ?? ''
|
||
|
]);
|
||
|
}
|
||
|
}
|