| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Module\Pet\Events;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 宠物创建事件
- *
- * 当新宠物被创建时触发此事件,允许其他系统响应宠物的创建。
- * 此事件可用于记录宠物创建日志、更新用户状态、处理新手引导等。
- * 经过优化,只保留必要的用户ID和宠物ID属性。
- */
- class PetCreatedEvent
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- /**
- * 用户ID
- *
- * @var int
- */
- public int $userId;
- /**
- * 宠物ID
- *
- * @var int
- */
- public int $petId;
- /**
- * 创建一个新的事件实例
- *
- * @param int $userId 用户ID
- * @param int $petId 宠物ID
- * @return void
- */
- public function __construct(int $userId, int $petId)
- {
- $this->userId = $userId;
- $this->petId = $petId;
- }
- }
|