31 lines
855 B
PHP
31 lines
855 B
PHP
<?php
|
|
namespace Incoviba;
|
|
|
|
use \Model;
|
|
|
|
class Unidad extends Model {
|
|
public static $_table = 'unidad';
|
|
|
|
protected $propiedad_unidad;
|
|
public function propiedad_unidad() {
|
|
if ($this->propiedad_unidad === null) {
|
|
$this->propiedad_unidad = $this->has_one(PropiedadUnidad::class, 'unidad')->find_one();
|
|
}
|
|
return $this->propiedad_unidad;
|
|
}
|
|
protected $proyecto_tipo_unidad;
|
|
public function proyecto_tipo_unidad() {
|
|
if ($this->proyecto_tipo_unidad === null) {
|
|
$this->proyecto_tipo_unidad = $this->belongs_to(ProyectoTipoUnidad::class, 'pt')->find_one();
|
|
}
|
|
return $this->proyecto_tipo_unidad;
|
|
}
|
|
protected $facturas;
|
|
public function facturas() {
|
|
if ($this->facturas === null) {
|
|
$this->facturas = $this->has_many(FacturaUnidad::class, 'unidad_id')->find_many();
|
|
}
|
|
return $this->facturas;
|
|
}
|
|
}
|