|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
namespace app\Models; |
|
|
|
|
namespace app\Repositories; |
|
|
|
|
|
|
|
|
|
use app\Core\Repository; |
|
|
|
|
use app\Models\UsuarioModel; |
|
|
|
|
use Exception; |
|
|
|
|
|
|
|
|
|
class UsuarioRepository extends Repository |
|
|
|
|
{ |
|
|
|
@ -10,4 +12,18 @@ class UsuarioRepository extends Repository
|
|
|
|
|
{ |
|
|
|
|
$this->table = UsuarioModel::$table; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function list(array $params = []): array |
|
|
|
|
{ |
|
|
|
|
$table = $this->table; |
|
|
|
|
$query = "SELECT * FROM $table WHERE 1=1"; |
|
|
|
|
if ($params['matricula']) { |
|
|
|
|
$query .= " AND matricula = :matricula "; |
|
|
|
|
$dados['matricula'] = $params['matricula']; |
|
|
|
|
} |
|
|
|
|
if (empty($params['matricula'])) { |
|
|
|
|
throw new Exception('Parâmetro matricula é obrigatório'); |
|
|
|
|
} |
|
|
|
|
return $this->db->read($query, $params)->fetchAll(); |
|
|
|
|
} |
|
|
|
|
} |