From be26c85d82ade384c7dfef0a7b2beff8edee70a3 Mon Sep 17 00:00:00 2001 From: ctexthuang Date: Sun, 23 Mar 2025 19:18:08 +0800 Subject: [PATCH] feat: config --- app/Command/EventCommand.php | 35 ++++++++++++++++++++++ app/Command/stubs/event.stub | 15 ++++++++++ app/Event/RegistrationEvent.php | 18 +++++++++++ app/Listener/FirstRegistrationListener.php | 30 +++++++++++++++++++ composer.json | 1 + 5 files changed, 99 insertions(+) create mode 100644 app/Command/EventCommand.php create mode 100644 app/Command/stubs/event.stub create mode 100644 app/Event/RegistrationEvent.php create mode 100644 app/Listener/FirstRegistrationListener.php diff --git a/app/Command/EventCommand.php b/app/Command/EventCommand.php new file mode 100644 index 0000000..69539f7 --- /dev/null +++ b/app/Command/EventCommand.php @@ -0,0 +1,35 @@ +setDescription('Create a new event class'); + + parent::configure(); + } + + protected function getStub(): string + { + return __DIR__ . '/stubs/event.stub'; + } + + protected function getDefaultNamespace(): string + { + return 'App\\Event'; + } +} diff --git a/app/Command/stubs/event.stub b/app/Command/stubs/event.stub new file mode 100644 index 0000000..400ef31 --- /dev/null +++ b/app/Command/stubs/event.stub @@ -0,0 +1,15 @@ +xxx = $xxx; + } +} diff --git a/app/Event/RegistrationEvent.php b/app/Event/RegistrationEvent.php new file mode 100644 index 0000000..9a1eacf --- /dev/null +++ b/app/Event/RegistrationEvent.php @@ -0,0 +1,18 @@ +userId = $userId; + } +} diff --git a/app/Listener/FirstRegistrationListener.php b/app/Listener/FirstRegistrationListener.php new file mode 100644 index 0000000..b7fc154 --- /dev/null +++ b/app/Listener/FirstRegistrationListener.php @@ -0,0 +1,30 @@ +