Skip to content

Commit 5d08776

Browse files
committed
Add jsonSerialize to EventLog models
1 parent d28e034 commit 5d08776

File tree

2 files changed

+34
-12
lines changed

2 files changed

+34
-12
lines changed

src/Models/EventLog/Index.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@
22

33
namespace BNETDocs\Models\EventLog;
44

5-
class Index extends \BNETDocs\Models\ActiveUser
5+
class Index extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
66
{
7-
public bool $acl_allowed = false;
8-
public ?array $events = null;
9-
public int $limit = 0;
10-
public string $order = '';
11-
public int $page = 0;
12-
public int $pages = 0;
13-
public int $sum_events = 0;
7+
public bool $acl_allowed = false;
8+
public ?array $events = null;
9+
public int $limit = 0;
10+
public string $order = '';
11+
public int $page = 0;
12+
public int $pages = 0;
13+
public int $sum_events = 0;
14+
15+
public function jsonSerialize(): mixed
16+
{
17+
return \array_merge(parent::jsonSerialize(), [
18+
'acl_allowed' => $this->acl_allowed,
19+
'events' => $this->events,
20+
'limit' => $this->limit,
21+
'order' => $this->order,
22+
'page' => $this->page,
23+
'pages' => $this->pages,
24+
'sum_events' => $this->sum_events,
25+
]);
26+
}
1427
}

src/Models/EventLog/View.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,18 @@
22

33
namespace BNETDocs\Models\EventLog;
44

5-
class View extends \BNETDocs\Models\ActiveUser
5+
class View extends \BNETDocs\Models\ActiveUser implements \JsonSerializable
66
{
7-
public bool $acl_allowed = false;
8-
public ?\BNETDocs\Libraries\EventLog\Event $event = null;
9-
public ?int $id = null;
7+
public bool $acl_allowed = false;
8+
public ?\BNETDocs\Libraries\EventLog\Event $event = null;
9+
public ?int $id = null;
10+
11+
public function jsonSerialize(): mixed
12+
{
13+
return \array_merge(parent::jsonSerialize(), [
14+
'acl_allowed' => $this->acl_allowed,
15+
'event' => $this->event,
16+
'id' => $this->id,
17+
]);
18+
}
1019
}

0 commit comments

Comments
 (0)