tipo === null) { $this->tipo = $this->childOf(TipoFuente::class, [Model::SELF_KEY => 'tipo_id']); } return $this->tipo; } protected $banco; public function banco() { if ($this->banco === null) { $this->banco = $this->childOf(Banco::class, [Model::SELF_KEY => 'banco_id']); } return $this->banco; } protected $entradas; public function entradas() { if ($this->entradas === null) { $this->entradas = $this->parentOf(Entrada::class, [Model::CHILD_KEY => 'fuente_id']); } return $this->entradas; } public function toArray(): array { $arr = parent::toArray(); $arr['tipo'] = $this->tipo()->toArray(); $arr['banco'] = $this->banco()->toArray(); return $arr; } }