mirror of
https://github.com/pterodactyl/panel.git
synced 2024-11-22 17:12:30 +01:00
cbcf62086f
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
35 lines
686 B
PHP
35 lines
686 B
PHP
<?php
|
|
|
|
namespace Pterodactyl\Events;
|
|
|
|
use Illuminate\Support\Str;
|
|
use Pterodactyl\Models\ActivityLog;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
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 is_null($this->model->actor_id);
|
|
}
|
|
}
|