Base de Datos
This commit is contained in:
41
app/src/Model/Proyecto/Broker/Contract.php
Normal file
41
app/src/Model/Proyecto/Broker/Contract.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace Incoviba\Model\Proyecto\Broker;
|
||||
|
||||
use Incoviba\Common;
|
||||
use Incoviba\Model;
|
||||
|
||||
class Contract extends Common\Ideal\Model
|
||||
{
|
||||
public Model\Proyecto $project;
|
||||
public Model\Proyecto\Broker $broker;
|
||||
public float $commission;
|
||||
protected array $states = [];
|
||||
|
||||
public function states(): array
|
||||
{
|
||||
if (!isset($this->states)) {
|
||||
$this->states = $this->runFactory('states');
|
||||
}
|
||||
return $this->states;
|
||||
}
|
||||
|
||||
protected Contract\State $current;
|
||||
public function currentState(): Contract\State
|
||||
{
|
||||
if (!isset($this->current)) {
|
||||
$this->current = last($this->states());
|
||||
}
|
||||
return $this->current;
|
||||
}
|
||||
|
||||
protected function jsonComplement(): array
|
||||
{
|
||||
return [
|
||||
'project_id' => $this->project->id,
|
||||
'broker_rut' => $this->broker->rut,
|
||||
'commission' => $this->commission,
|
||||
'states' => $this->states(),
|
||||
'current' => $this->currentState(),
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user