|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Gewaer\Api\Controllers; |
|
6
|
|
|
|
|
7
|
|
|
use Gewaer\Models\UserWebhooks; |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Class LanguagesController |
|
11
|
|
|
* |
|
12
|
|
|
* @package Gewaer\Api\Controllers |
|
13
|
|
|
* |
|
14
|
|
|
* @property Users $userData |
|
15
|
|
|
* @property Request $request |
|
16
|
|
|
* @property Config $config |
|
17
|
|
|
* @property Apps $app |
|
18
|
|
|
* |
|
19
|
|
|
*/ |
|
20
|
|
|
class UserWebhooksController extends BaseController |
|
21
|
|
|
{ |
|
22
|
|
|
/* |
|
23
|
|
|
* fields we accept to create |
|
24
|
|
|
* |
|
25
|
|
|
* @var array |
|
26
|
|
|
*/ |
|
27
|
|
|
protected $createFields = ['webhooks_id', 'url', 'method', 'format']; |
|
28
|
|
|
|
|
29
|
|
|
/* |
|
30
|
|
|
* fields we accept to create |
|
31
|
|
|
* |
|
32
|
|
|
* @var array |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $updateFields = ['webhooks_id', 'url', 'method', 'format']; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* set objects |
|
38
|
|
|
* |
|
39
|
|
|
* @return void |
|
40
|
|
|
*/ |
|
41
|
5 |
|
public function onConstruct() |
|
42
|
|
|
{ |
|
43
|
5 |
|
$this->model = new UserWebhooks(); |
|
44
|
5 |
|
$this->model->users_id = $this->userData->getId(); |
|
45
|
5 |
|
$this->model->companies_id = $this->userData->currentCompanyId(); |
|
46
|
5 |
|
$this->model->apps_id = $this->app->getId(); |
|
47
|
5 |
|
$this->additionalSearchFields = [ |
|
48
|
5 |
|
['is_deleted', ':', '0'], |
|
49
|
5 |
|
['apps_id', ':', $this->app->getId()], |
|
50
|
5 |
|
['companies_id', ':', '0|' . $this->userData->currentCompanyId()], |
|
51
|
|
|
]; |
|
52
|
5 |
|
} |
|
53
|
|
|
} |
|
54
|
|
|
|