Browse Source

Add attributes in PauseModel

main
lucas cardoso 2 years ago
parent
commit
a192fe3292
  1. 36
      app/Models/PauseModel.php

36
app/Models/PauseModel.php

@ -4,7 +4,41 @@ namespace app\Models;
use app\Interfaces\IModel;
class PauseModel
class PauseModel implements IModel
{
static string $table = 'motivos_pausas';
public ?int $id;
public string $motivo;
public int $id_empresa;
public ?bool $is_ativo;
function __construct(
$id = null,
$motivo,
$id_empresa,
$is_ativo = null
) {
$this->id = $id;
$this->motivo = $motivo;
$this->id_empresa = $id_empresa;
$this->is_ativo = $is_ativo;
}
function toArray(): array
{
return [
'id' => $this->id,
'motivo' => $this->motivo,
'id_empresa' => $this->id_empresa,
'is_ativo' => $this->is_ativo
];
}
static function ArrayTo(array $params): self
{
return new self(
id: $params['id'],
motivo: $params['motivo'],
id_empresa: $params['id_empresa'],
is_ativo: $params['is_ativo']
);
}
}
Loading…
Cancel
Save