Files
oficial/app/src/Model/Venta/Propietario.php
Juan Pablo Vial 3141f1e7c4 Search
2023-09-28 21:05:16 -03:00

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 ?? ''
]);
}
}