forked from SimplesIP/pabx-app
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
<?php |
|
|
|
namespace app\Models; |
|
|
|
use app\Core\Model; |
|
|
|
|
|
/** |
|
* Clase para criacao de Querys no banco de dados. |
|
* |
|
* Todas as querys desta classe esta especificada para o uso do WhatsApp. |
|
* |
|
* @author Lucas Awade |
|
*/ |
|
class Queue extends Model |
|
{ |
|
|
|
const TABLE = "pbx_queues_grupos"; |
|
|
|
public function findAllQueue($active = true) |
|
{ |
|
$this->query = "SELECT id, nome FROM " . self::TABLE . " WHERE 1=1 AND midiafila = :midiafila "; |
|
if ($active) { |
|
$this->query .= " AND status = :status "; |
|
$data['status'] = 'A'; |
|
} |
|
$data['midiafila'] = "S"; |
|
$this->query .= " ORDER BY nome LIMIT 10 "; |
|
return $this->read($this->query, $data)->fetchAll(); |
|
} |
|
|
|
public function findQueueByName($nome, $active = true) |
|
{ |
|
$this->query = "SELECT * FROM " . self::TABLE . " WHERE nome = :nome "; |
|
if ($active) { |
|
$this->query .= " AND status = :status "; |
|
$data['status'] = 'A'; |
|
} |
|
$data['nome'] = $nome; |
|
return $this->read($this->query, $data)->fetch(); |
|
} |
|
|
|
public function findQueueById($id, $active = true) |
|
{ |
|
$this->query = "SELECT * FROM " . self::TABLE . " WHERE id = :id "; |
|
if ($active) { |
|
$this->query .= " AND status = :status "; |
|
$data['status'] = 'A'; |
|
} |
|
$data['id'] = $id; |
|
return $this->read($this->query, $data)->fetch(); |
|
} |
|
} |