Browse Source

Add filter token and id in list Repo empresa

main
lucas cardoso 2 years ago
parent
commit
91135dd329
  1. 19
      app/Repositories/EmpresaRepository.php

19
app/Repositories/EmpresaRepository.php

@ -11,4 +11,23 @@ class EmpresaRepository extends Repository
{
$this->table = EmpresaModel::$table;
}
function list(array $params = []): array
{
$table = EmpresaModel::$table;
$query = "SELECT * FROM $table WHERE 1=1";
if ($params['token']) {
$query .= " AND token = :token ";
$dados['token'] = $params['token'];
}
if ($params['id']) {
$query .= " AND id = :id ";
$dados['id'] = $params['id'];
}
return $this->db->read($query, $dados)->fetchAll();
}
}
Loading…
Cancel
Save