| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App\Module\Farm\Events;
- use App\Module\Farm\Models\FarmCrop;
- use App\Module\Farm\Models\FarmHarvestLog;
- use App\Module\Farm\Models\FarmLand;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 作物收获事件
- *
- * 当用户收获作物时触发
- */
- class CropHarvestedEvent
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- /**
- * 用户ID
- *
- * @var int
- */
- public $userId;
- /**
- * 土地信息
- *
- * @var FarmLand
- */
- public $land;
- /**
- * 作物信息
- *
- * @var FarmCrop
- */
- public $crop;
- /**
- * 收获记录
- *
- * @var FarmHarvestLog
- */
- public $harvestLog;
- /**
- * 产出物品ID
- *
- * @var int
- */
- public $outputItemId;
- /**
- * 产出数量
- *
- * @var int
- */
- public $outputAmount;
- /**
- * 创建一个新的事件实例
- *
- * @param int $userId
- * @param FarmLand $land
- * @param FarmCrop $crop
- * @param FarmHarvestLog $harvestLog
- * @param int $outputItemId
- * @param int $outputAmount
- * @return void
- */
- public function __construct(
- int $userId,
- FarmLand $land,
- FarmCrop $crop,
- FarmHarvestLog $harvestLog,
- int $outputItemId,
- int $outputAmount
- ) {
- $this->userId = $userId;
- $this->land = $land;
- $this->crop = $crop;
- $this->harvestLog = $harvestLog;
- $this->outputItemId = $outputItemId;
- $this->outputAmount = $outputAmount;
- }
- }
|