diff --git a/app/Models/UsuarioModel.php b/app/Models/UsuarioModel.php index 0b53bc7..bd5b47d 100644 --- a/app/Models/UsuarioModel.php +++ b/app/Models/UsuarioModel.php @@ -4,7 +4,45 @@ namespace app\Models; use app\Interfaces\IModel; -class UsuarioModel +class UsuarioModel implements IModel { + public ?int $id; + public string $nome; + public string $email; + public string $matricula; + public bool $status; + public string $perm; static string $table = 'usuarios'; + function __construct(?int $id, string $nome, string $email, string $matricula, bool $status, string $perm) + { + $this->id = $id; + $this->nome = $nome; + $this->email = $email; + $this->matricula = $matricula; + $this->status = $status; + $this->perm = $perm; + } + function toArray(): array + { + return [ + 'id' => $this->id, + 'nome' => $this->nome, + 'email' => $this->email, + 'matricula' => $this->matricula, + 'status' => $this->status, + 'perm' => $this->perm + ]; + } + + static function ArrayTo(array $params): self + { + return new self( + id: $params['id'], + nome: $params['nome'], + email: $params['email'], + matricula: $params['matricula'], + status: $params['status'], + perm: $params['perm'] + ); + } } \ No newline at end of file