old models
This commit is contained in:
41
src/old/Proyecto/Agente.php
Normal file
41
src/old/Proyecto/Agente.php
Normal 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();
|
||||
}
|
||||
}
|
||||
?>
|
Reference in New Issue
Block a user