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, + ], ]; /**