mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 02:54:45 +02:00

* update composer.lock * run pint * fix phpstan * update migrations (sqlite `dropForeign`) * fix migrations * Reset these back for now * Alphabetize the rules * run `php artisan filament:upgrade` --------- Co-authored-by: Lance Pioch <git@lance.sh>
33 lines
661 B
PHP
33 lines
661 B
PHP
<?php
|
|
|
|
namespace App\Events;
|
|
|
|
use Illuminate\Support\Str;
|
|
use App\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);
|
|
}
|
|
}
|