Cambios en Agentes
This commit is contained in:
@ -24,4 +24,12 @@ class AgenteTipo extends Model {
|
||||
return $this->tipo_obj;
|
||||
//return $this->belongsTo(TipoAgente::class, 'tipo')->findOne();
|
||||
}
|
||||
protected $proyectos;
|
||||
public function proyectos()
|
||||
{
|
||||
if ($this->proyectos === null) {
|
||||
$this->proyectos = $this->hasMany(ProyectoAgente::class, 'agente')->findMany();
|
||||
}
|
||||
return $this->proyectos;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,13 @@ class ProyectoAgente extends Model
|
||||
{
|
||||
return $this->belongsTo(AgenteTipo::class, 'agente')->findOne();
|
||||
}
|
||||
public function fecha(\DateTime $fecha = null)
|
||||
{
|
||||
if ($fecha == null) {
|
||||
return Carbon::parse($this->fecha, config('app.timezone'));
|
||||
}
|
||||
$this->fecha = $fecha->format('Y-m-d');
|
||||
}
|
||||
public function estado()
|
||||
{
|
||||
return $this->hasMany(EstadoProyectoAgente::class, 'agente')
|
||||
|
Reference in New Issue
Block a user