misc_pterodactyl-panel/app/Events/ActivityLogged.php
Matthew Penner cbcf62086f
Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
2022-10-14 10:59:20 -06:00

34 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);
}
}