Files

35 lines
703 B
PHP
Raw Permalink Normal View History

<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
namespace Pterodactyl\Events;
2026-10-05 18:10:18 -04:00
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
use Pterodactyl\Models\ActivityLog;
class ActivityLogged extends Event
{
2026-10-05 18:10:18 -04:00
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;
}
2022-10-14 10:59:20 -06:00
public function isServerEvent(): bool
{
return Str::startsWith($this->model->event, 'server:');
}
2022-10-14 10:59:20 -06:00
public function isSystem(): bool
{
2026-10-05 18:10:18 -04:00
return $this->model->actor_id === null;
}
}