forked from pterodactyl/panel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathActivityLogTransformer.php
More file actions
37 lines (30 loc) · 976 Bytes
/
ActivityLogTransformer.php
File metadata and controls
37 lines (30 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace Pterodactyl\Transformers\Api\Client;
use Pterodactyl\Models\User;
use Pterodactyl\Models\ActivityLog;
class ActivityLogTransformer extends BaseClientTransformer
{
protected array $availableIncludes = ['actor'];
public function getResourceName(): string
{
return ActivityLog::RESOURCE_NAME;
}
public function transform(ActivityLog $model): array
{
return [
'batch' => $model->batch,
'event' => $model->event,
'ip' => $model->ip,
'description' => $model->description,
'properties' => $model->properties,
'timestamp' => $model->timestamp->toIso8601String(),
];
}
public function includeActor(ActivityLog $model)
{
if (!$model->actor instanceof User) {
return $this->null();
}
return $this->item($model->actor, $this->makeTransformer(UserTransformer::class), User::RESOURCE_NAME);
}
}