ConfigChangedEvent.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace App\Module\System\Events;
  3. use App\Module\System\Models\AppConfig;
  4. use Illuminate\Broadcasting\InteractsWithSockets;
  5. use Illuminate\Foundation\Events\Dispatchable;
  6. use Illuminate\Queue\SerializesModels;
  7. /**
  8. * 配置变更事件
  9. */
  10. class ConfigChangedEvent
  11. {
  12. use Dispatchable, InteractsWithSockets, SerializesModels;
  13. /**
  14. * 配置键名
  15. *
  16. * @var string
  17. */
  18. public string $keyname;
  19. /**
  20. * 旧值
  21. *
  22. * @var mixed
  23. */
  24. public $oldValue;
  25. /**
  26. * 新值
  27. *
  28. * @var mixed
  29. */
  30. public $newValue;
  31. /**
  32. * 配置对象
  33. *
  34. * @var AppConfig
  35. */
  36. public AppConfig $config;
  37. /**
  38. * 管理员ID
  39. *
  40. * @var int
  41. */
  42. public int $adminId;
  43. /**
  44. * 创建一个新的事件实例
  45. *
  46. * @param AppConfig $config
  47. * @param mixed $oldValue
  48. * @param int $adminId
  49. * @return void
  50. */
  51. public function __construct(AppConfig $config, $oldValue, int $adminId = 0)
  52. {
  53. $this->keyname = $config->keyname;
  54. $this->oldValue = $oldValue;
  55. $this->newValue = $config->value;
  56. $this->config = $config;
  57. $this->adminId = $adminId;
  58. }
  59. }