Mas cambios de controles
This commit is contained in:
@ -315,6 +315,7 @@ class Proyecto extends Model
|
|||||||
if (!isset($this->estado)) {
|
if (!isset($this->estado)) {
|
||||||
$id = $this->has_many(EstadoProyecto::class, 'proyecto')->max('id');
|
$id = $this->has_many(EstadoProyecto::class, 'proyecto')->max('id');
|
||||||
$this->estado = $this->has_many(EstadoProyecto::class, 'proyecto')->findOne($id);
|
$this->estado = $this->has_many(EstadoProyecto::class, 'proyecto')->findOne($id);
|
||||||
|
$this->estado->setContainer($this->container);
|
||||||
}
|
}
|
||||||
return $this->estado;
|
return $this->estado;
|
||||||
}
|
}
|
||||||
@ -339,6 +340,7 @@ class Proyecto extends Model
|
|||||||
if (!isset($this->inicio) or $this->inicio == null) {
|
if (!isset($this->inicio) or $this->inicio == null) {
|
||||||
$id = $this->has_many(EstadoProyecto::class, 'proyecto')->min('id');
|
$id = $this->has_many(EstadoProyecto::class, 'proyecto')->min('id');
|
||||||
$this->inicio = $this->has_many(EstadoProyecto::class, 'proyecto')->findOne($id);
|
$this->inicio = $this->has_many(EstadoProyecto::class, 'proyecto')->findOne($id);
|
||||||
|
$this->inicio->setContainer($this->container);
|
||||||
}
|
}
|
||||||
return $this->inicio;
|
return $this->inicio;
|
||||||
}
|
}
|
||||||
|
@ -315,8 +315,8 @@ class Cierre extends Model
|
|||||||
if (!$estado) {
|
if (!$estado) {
|
||||||
$data['fecha'] = $fecha->format('Y-m-d');
|
$data['fecha'] = $fecha->format('Y-m-d');
|
||||||
$estado = model(EstadoCierre::class)->create($data);
|
$estado = model(EstadoCierre::class)->create($data);
|
||||||
$estado->setContainer($this->container);
|
|
||||||
$estado->save();
|
$estado->save();
|
||||||
|
$estado->setContainer($this->container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected $promesa;
|
protected $promesa;
|
||||||
@ -354,4 +354,12 @@ class Cierre extends Model
|
|||||||
$dif = $today->diffInDays($this->fecha());
|
$dif = $today->diffInDays($this->fecha());
|
||||||
return $dif;
|
return $dif;
|
||||||
}
|
}
|
||||||
|
public function toArray() {
|
||||||
|
$arr = $this->asArray();
|
||||||
|
$arr['proyecto'] = $this->proyecto()->asArray();
|
||||||
|
if ($this->propietario()) {
|
||||||
|
$arr['propietario'] = $this->propietario()->asArray();
|
||||||
|
}
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user