Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Events/ActivityLogged.php
7432 views
1
<?php
2
3
namespace Pterodactyl\Events;
4
5
use Illuminate\Support\Str;
6
use Pterodactyl\Models\ActivityLog;
7
use Illuminate\Database\Eloquent\Model;
8
9
class ActivityLogged extends Event
10
{
11
public function __construct(public ActivityLog $model)
12
{
13
}
14
15
public function is(string $event): bool
16
{
17
return $this->model->event === $event;
18
}
19
20
public function actor(): ?Model
21
{
22
return $this->isSystem() ? null : $this->model->actor;
23
}
24
25
public function isServerEvent(): bool
26
{
27
return Str::startsWith($this->model->event, 'server:');
28
}
29
30
public function isSystem(): bool
31
{
32
return is_null($this->model->actor_id);
33
}
34
}
35
36