Files
modelos/src/old/Proyecto/Agente.php

42 lines
894 B
PHP
Raw Normal View History

2019-12-23 18:01:23 -03:00
<?php
namespace Incoviba\old\Proyecto;
use Incoviba\Common\Alias\OldModel as Model;
use Incoviba\old\Common\Direccion;
/**
*
* @author Aldarien
*
* @property int id
* @property TipoAgente tipo
* @property int rut
* @property string descripcion
* @property string representante
* @property int telefono
* @property string correo
* @property Direccion direccion
* @property string giro
* @property string abreviacion
*
*/
class Agente extends Model
{
public function direccion()
{
return $this->belongs_to(Direccion::class, 'direccion')->findOne();
}
public function tipo()
{
return $this->belongs_to(TipoAgente::class, 'tipo')->findOne();
}
public function tipos(int $tipo = 0)
{
if ($tipo == 0) {
return $this->hasMany(AgenteTipo::class, 'agente')->findMany();
}
return $this->hasMany(AgenteTipo::class, 'agente')->where('tipo', $tipo)->findOne();
}
}
?>