| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace App\Module\Farm\Events;
- use App\Module\Farm\Models\FarmCrop;
- use App\Module\Farm\Models\FarmLand;
- use Illuminate\Broadcasting\InteractsWithSockets;
- use Illuminate\Foundation\Events\Dispatchable;
- use Illuminate\Queue\SerializesModels;
- /**
- * 作物种植事件
- *
- * 当用户在土地上种植作物时触发
- */
- class CropPlantedEvent
- {
- use Dispatchable, InteractsWithSockets, SerializesModels;
- /**
- * 用户ID
- *
- * @var int
- */
- public $userId;
- /**
- * 土地信息
- *
- * @var FarmLand
- */
- public $land;
- /**
- * 作物信息
- *
- * @var FarmCrop
- */
- public $crop;
- /**
- * 创建一个新的事件实例
- *
- * @param int $userId
- * @param FarmLand $land
- * @param FarmCrop $crop
- * @return void
- */
- public function __construct(int $userId, FarmLand $land, FarmCrop $crop)
- {
- $this->userId = $userId;
- $this->land = $land;
- $this->crop = $crop;
- }
- }
|