Merge branch 'develop'

This commit is contained in:
2020-02-18 11:59:50 -03:00
2 changed files with 15 additions and 0 deletions

View File

@ -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;
}
}

View File

@ -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')