LandUpgradedEvent.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace App\Module\Farm\Events;
  3. use App\Module\Farm\Models\FarmLand;
  4. use App\Module\Farm\Models\FarmUpgradeLog;
  5. use Illuminate\Broadcasting\InteractsWithSockets;
  6. use Illuminate\Foundation\Events\Dispatchable;
  7. use Illuminate\Queue\SerializesModels;
  8. /**
  9. * 土地升级事件
  10. *
  11. * 当用户升级土地时触发
  12. */
  13. class LandUpgradedEvent
  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 int
  32. */
  33. public $oldType;
  34. /**
  35. * 新土地类型
  36. *
  37. * @var int
  38. */
  39. public $newType;
  40. /**
  41. * 升级记录
  42. *
  43. * @var FarmUpgradeLog
  44. */
  45. public $upgradeLog;
  46. /**
  47. * 创建一个新的事件实例
  48. *
  49. * @param int $userId
  50. * @param FarmLand $land
  51. * @param int $oldType
  52. * @param int $newType
  53. * @param FarmUpgradeLog $upgradeLog
  54. * @return void
  55. */
  56. public function __construct(
  57. int $userId,
  58. FarmLand $land,
  59. int $oldType,
  60. int $newType,
  61. FarmUpgradeLog $upgradeLog
  62. ) {
  63. $this->userId = $userId;
  64. $this->land = $land;
  65. $this->oldType = $oldType;
  66. $this->newType = $newType;
  67. $this->upgradeLog = $upgradeLog;
  68. }
  69. }