| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace App\Module\Pet\Events;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 宠物更新事件
- *
- * 当宠物数据发生重大变更时触发此事件,允许其他系统响应宠物的更新。
- * 此事件应在宠物升级、洗髓、重置等场景触发,表示宠物数据发生了重大变化。
- * 结构与PetCreatedEvent一致,只包含用户ID和宠物ID属性。
- */
- class PetUpdateEvent
- {
- 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;
- }
- }
|