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.

46 lines
1.0 KiB

3 years ago
<?php
namespace app\Models;
use app\Core\Model;
/**
* Description of NotificaMedia
*
* @author root
*/
class NotificaMedia extends Model
{
const table = "pbx_notifica_media";
public function verificaNotifica($uniqueid, $src, $msg)
{
$this->query = "SELECT count(*) as quant FROM " .
self::table .
" WHERE uniqueid = :uniqueid and src = :src and msg = :msg";
return $this->read(
$this->query,
[
'uniqueid' => $uniqueid,
'src' => $src,
'msg' => $msg
]
)->fetch();
}
public function addNotifica($uniqueid, $src, $msg)
{
$data = [
'uniqueid' => $uniqueid,
'src' => $src,
'msg' => $msg,
];
$this->query = "INSERT INTO " . self::table . " (uniqueid, src, msg) VALUES(:uniqueid, :src, :msg);";
logger('notificacao')->error(print_r($data, true));
return $this->create(
$this->query,
$data
);
}
}