Promociones para cada subdivicion
This commit is contained in:
@ -26,13 +26,13 @@ class Promotion extends Common\Ideal\Model
|
||||
return $this->projects;
|
||||
}
|
||||
|
||||
protected array $contracts;
|
||||
public function contracts(): array
|
||||
protected array $brokers;
|
||||
public function brokers(): array
|
||||
{
|
||||
if (empty($this->contracts)) {
|
||||
$this->contracts = $this->runFactory('contracts') ?? [];
|
||||
if (empty($this->brokers)) {
|
||||
$this->brokers = $this->runFactory('brokers') ?? [];
|
||||
}
|
||||
return $this->contracts;
|
||||
return $this->brokers;
|
||||
}
|
||||
|
||||
protected array $unitTypes;
|
||||
@ -61,15 +61,6 @@ class Promotion extends Common\Ideal\Model
|
||||
return $this->units;
|
||||
}
|
||||
|
||||
protected array $contractUnits;
|
||||
public function contractUnits(): array
|
||||
{
|
||||
if (empty($this->contractUnits)) {
|
||||
$this->contractUnits = $this->runFactory('contractUnits');
|
||||
}
|
||||
return $this->contractUnits;
|
||||
}
|
||||
|
||||
public function value(float $price): float
|
||||
{
|
||||
if ($this->type === Type::FIXED) {
|
||||
@ -89,7 +80,7 @@ class Promotion extends Common\Ideal\Model
|
||||
'type' => $this->type,
|
||||
'state' => $this->state,
|
||||
'projects' => $this->projects() ?? [],
|
||||
'contracts' => $this->contracts() ?? [],
|
||||
'contracts' => $this->brokers() ?? [],
|
||||
'units' => $this->units() ?? []
|
||||
];
|
||||
}
|
||||
|
Reference in New Issue
Block a user