CropPlantedEvent.php 1010 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace App\Module\Farm\Events;
  3. use App\Module\Farm\Models\FarmCrop;
  4. use App\Module\Farm\Models\FarmLand;
  5. use Illuminate\Broadcasting\InteractsWithSockets;
  6. use Illuminate\Foundation\Events\Dispatchable;
  7. use Illuminate\Queue\SerializesModels;
  8. /**
  9. * 作物种植事件
  10. *
  11. * 当用户在土地上种植作物时触发
  12. */
  13. class CropPlantedEvent
  14. {
  15. use Dispatchable, InteractsWithSockets, SerializesModels;
  16. /**
  17. * 用户ID
  18. *
  19. * @var int
  20. */
  21. public $userId;
  22. /**
  23. * 土地信息
  24. *
  25. * @var FarmLand
  26. */
  27. public $land;
  28. /**
  29. * 作物信息
  30. *
  31. * @var FarmCrop
  32. */
  33. public $crop;
  34. /**
  35. * 创建一个新的事件实例
  36. *
  37. * @param int $userId
  38. * @param FarmLand $land
  39. * @param FarmCrop $crop
  40. * @return void
  41. */
  42. public function __construct(int $userId, FarmLand $land, FarmCrop $crop)
  43. {
  44. $this->userId = $userId;
  45. $this->land = $land;
  46. $this->crop = $crop;
  47. }
  48. }