states) or count($this->states) === 0) { $this->states = $this->runFactory('states'); } return $this->states; } protected ?Contract\State $current; public function current(): ?Contract\State { if (!isset($this->current)) { try { $this->current = last($this->states()); } catch (\TypeError $error) { $this->current = null; } } return $this->current; } protected array $promotions = []; public function promotions(): array { if (count($this->promotions) === 0) { $this->promotions = $this->runFactory('promotions'); } return $this->promotions; } protected function jsonComplement(): array { return [ 'project_id' => $this->project->id, 'broker_rut' => $this->broker->rut, 'commission' => $this->commission, 'states' => $this->states(), 'current' => $this->current(), ]; } }