mirror of
https://github.com/pterodactyl/panel.git
synced 2026-11-30 11:25:52 -05:00
Co-authored-by: Anthony <anthony@infraly.co> Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
35 lines
703 B
PHP
35 lines
703 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Pterodactyl\Events;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
use Pterodactyl\Models\ActivityLog;
|
|
|
|
class ActivityLogged extends Event
|
|
{
|
|
public function __construct(public ActivityLog $model) {}
|
|
|
|
public function is(string $event): bool
|
|
{
|
|
return $this->model->event === $event;
|
|
}
|
|
|
|
public function actor(): ?Model
|
|
{
|
|
return $this->isSystem() ? null : $this->model->actor;
|
|
}
|
|
|
|
public function isServerEvent(): bool
|
|
{
|
|
return Str::startsWith($this->model->event, 'server:');
|
|
}
|
|
|
|
public function isSystem(): bool
|
|
{
|
|
return $this->model->actor_id === null;
|
|
}
|
|
}
|