| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace App\Module\System\Events;
- use App\Module\System\Models\SystemLog;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 系统日志创建事件
- */
- class SystemLogCreatedEvent
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- /**
- * 日志ID
- *
- * @var int
- */
- public int $id;
- /**
- * 日志类型
- *
- * @var string
- */
- public string $type;
- /**
- * 日志级别
- *
- * @var string
- */
- public string $level;
- /**
- * 日志消息
- *
- * @var string
- */
- public string $message;
- /**
- * 日志上下文
- *
- * @var array
- */
- public array $context;
- /**
- * 用户ID
- *
- * @var int|null
- */
- public ?int $userId;
- /**
- * 系统日志对象
- *
- * @var SystemLog
- */
- public SystemLog $log;
- /**
- * 创建一个新的事件实例
- *
- * @param SystemLog $log
- * @return void
- */
- public function __construct(SystemLog $log)
- {
- $this->id = $log->id;
- $this->type = $log->type;
- $this->level = $log->level;
- $this->message = $log->message;
- $this->context = $log->context ?? [];
- $this->userId = $log->user_id;
- $this->log = $log;
- }
- }
|