old models

This commit is contained in:
2019-12-23 18:01:23 -03:00
parent 50c2bb0f15
commit f67ab72e2a
72 changed files with 4625 additions and 0 deletions

View File

@ -0,0 +1,41 @@
<?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();
}
}
?>