mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 11:26:52 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			661 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			661 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Events;
 | 
						|
 | 
						|
use App\Models\ActivityLog;
 | 
						|
use Illuminate\Database\Eloquent\Model;
 | 
						|
use Illuminate\Support\Str;
 | 
						|
 | 
						|
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);
 | 
						|
    }
 | 
						|
}
 |