From 1441eaa6e402a0735fc2dfca22562f17c2ebd0e2 Mon Sep 17 00:00:00 2001 From: Bozhidar Date: Thu, 17 Oct 2024 11:09:45 +0300 Subject: [PATCH] update --- web/app/Events/DomainIsChanged.php | 36 +++++++++++++++++++ .../Controllers/Api/DomainsController.php | 3 ++ web/app/Listeners/DomainIsChangedListener.php | 26 ++++++++++++++ web/app/Providers/EventServiceProvider.php | 9 ++--- 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 web/app/Events/DomainIsChanged.php create mode 100644 web/app/Listeners/DomainIsChangedListener.php diff --git a/web/app/Events/DomainIsChanged.php b/web/app/Events/DomainIsChanged.php new file mode 100644 index 0000000..9dcb915 --- /dev/null +++ b/web/app/Events/DomainIsChanged.php @@ -0,0 +1,36 @@ + + */ + public function broadcastOn(): array + { + return [ + new PrivateChannel('channel-name'), + ]; + } +} diff --git a/web/app/Http/Controllers/Api/DomainsController.php b/web/app/Http/Controllers/Api/DomainsController.php index 6ae23b2..a93dda6 100644 --- a/web/app/Http/Controllers/Api/DomainsController.php +++ b/web/app/Http/Controllers/Api/DomainsController.php @@ -2,6 +2,7 @@ namespace app\Http\Controllers\Api; +use App\Events\DomainIsChanged; use App\Http\Controllers\ApiController; use App\Jobs\ApacheBuild; use App\Models\Domain; @@ -111,6 +112,8 @@ class DomainsController extends ApiController ApacheBuild::dispatchSync(); + event(new DomainIsChanged($findDomain)); + return response()->json([ 'status' => 'ok', 'message' => 'Domain updated', diff --git a/web/app/Listeners/DomainIsChangedListener.php b/web/app/Listeners/DomainIsChangedListener.php new file mode 100644 index 0000000..cd6ce5d --- /dev/null +++ b/web/app/Listeners/DomainIsChangedListener.php @@ -0,0 +1,26 @@ + [ SendEmailVerificationNotification::class, ], - ModelDomainDeleting::class => [ - ModelDomainDeletingListener::class, - ], ModelPhyreServerCreated::class => [ ModelPhyreServerCreatedListener::class, ], - + DomainIsChanged::class => [ + DomainIsChangedListener::class, + ], ]; /**