raspisms/models/Webhook.php

40 lines
963 B
PHP
Raw Normal View History

2019-12-04 03:04:45 +01:00
<?php
/*
* This file is part of RaspiSMS.
*
* (c) Pierre-Lin Bonnemaison <plebwebsas@gmail.com>
*
* This source file is subject to the GPL-3.0 license that is bundled
* with this source code in the file LICENSE.
*/
namespace models;
class Webhook extends StandardModel
{
2020-04-02 18:39:40 +02:00
const TYPE_SEND = 'send_sms';
const TYPE_RECEIVE = 'receive_sms';
2019-12-04 03:04:45 +01:00
/**
2020-01-17 18:19:25 +01:00
* Find all webhooks for a user and for a type of webhook.
*
* @param int $id_user : User id
* @param string $type : Webhook type
*
* @return array
*/
2020-01-17 18:19:25 +01:00
public function gets_for_type_and_user(int $id_user, string $type)
{
return $this->_select($this->get_table_name(), ['id_user' => $id_user, 'type' => $type]);
}
2020-01-17 18:19:25 +01:00
/**
* Return table name.
*/
protected function get_table_name(): string
{
return 'webhook';
}
2019-12-04 03:04:45 +01:00
}