PluginProbe
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration / trunk
FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration vtrunk
2.0.15 2.0.12 2.0.10 2.0.4 2.0.1 2.0.0 1.95.3 1.95.2 1.95 1.91.6 trunk 1.11 1.12 1.13 1.20 1.21 1.22 1.23 1.30 1.31 1.32 1.35 1.40 1.41 1.45 All 41 releases
fluent-boards / app / Models / Webhook.php

Webhook.php in FluentBoards – Project Management, Task Management, Goal Tracking, Kanban Board, and, Team Collaboration trunk, at app/Models/Webhook.php

71 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBoards\App\Models;
4
5 class Webhook extends Meta
6 {
7 protected $fillable = [
8 'object_id',
9 'object_type',
10 'key',
11 'value',
12 ];
13
14 public static function boot()
15 {
16 parent::boot();
17
18 static::addGlobalScope('type', function ($builder) {
19 $builder->where('object_type', '=', 'webhook');
20 });
21 }
22
23 public function getFields()
24 {
25 $taskFields = [
26 'fields' => [],
27 ];
28
29 foreach (Task::mappableFields() as $key => $column) {
30 $taskFields['fields'][] = ['key' => $key, 'field' => $column];
31 }
32
33 return $taskFields;
34 }
35
36 public function getSchema()
37 {
38 $schema = [
39 'name' => '',
40 'url' => '',
41 ];
42
43 return $schema;
44 }
45
46 public function store($data)
47 {
48 return static::create([
49 'object_type' => 'webhook',
50 'key' => $key = wp_generate_uuid4(),
51 'value' => array_merge($data, [
52 'url' => site_url("?fbs=1&route=task&hash={$key}")
53 ]),
54 ]);
55 }
56
57 public function saveChanges($data)
58 {
59 $this->value = array_merge(
60 $this->value,
61 array_diff_key($data, [
62 'id' => '', 'url' => ''
63 ])
64 );
65
66 $this->save();
67
68 return $this;
69 }
70 }
71