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.
 
 
 

41 lines
1.2 KiB

<?php
namespace app\Repositories;
use app\Core\Repository;
use app\Models\EventosAtendimentosModel;
class EventosAtendimentoRepository extends Repository
{
function config()
{
parent::$table = EventosAtendimentosModel::$table;
}
public function findEventFinish($uniqueid)
{
$table = self::$table;
$query = "SELECT * FROM $table
WHERE uniqueid = :uniqueid
AND evento in ('COMPLETE_AGENT', 'COMPLETE_AGENT');";
return $this->db->read($query, ['uniqueid' => $uniqueid])->fetch();
}
public function getStatusAtendimento($uniqueid)
{
$table = self::$table;
$query = "SELECT evento FROM $table WHERE uniqueid = :uniqueid ORDER BY id DESC LIMIT 1";
return $this->db->read($query, ['uniqueid' => $uniqueid])->fetch();
}
function get(array $params)
{
$table = self::$table;
$query = "SELECT * FROM $table WHERE 1=1 ";
if ($params['uniqueid']) {
$query .= " AND ma.uniqueid = :uniqueid ";
$dados['uniqueid'] = $params['uniqueid'];
}
return $this->db->read($query, $dados)->fetch();
}
}