| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Module\Farm\Events;
- use App\Module\Farm\Models\FarmCrop;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 灾害生成事件
- *
- * 当作物上生成灾害时触发
- */
- class DisasterGeneratedEvent
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- /**
- * 用户ID
- *
- * @var int
- */
- public $userId;
- /**
- * 作物信息
- *
- * @var FarmCrop
- */
- public $crop;
- /**
- * 灾害类型
- *
- * @var int
- */
- public $disasterType;
- /**
- * 灾害信息
- *
- * @var array
- */
- public $disasterInfo;
- /**
- * 创建一个新的事件实例
- *
- * @param int $userId
- * @param FarmCrop $crop
- * @param int $disasterType
- * @param array $disasterInfo
- * @return void
- */
- public function __construct(int $userId, FarmCrop $crop, int $disasterType, array $disasterInfo)
- {
- $this->userId = $userId;
- $this->crop = $crop;
- $this->disasterType = $disasterType;
- $this->disasterInfo = $disasterInfo;
- }
- }
|