diff --git a/app/Console/Commands/FireEvent.php b/app/Console/Commands/FireEvent.php index 91073f26..208d972f 100644 --- a/app/Console/Commands/FireEvent.php +++ b/app/Console/Commands/FireEvent.php @@ -10,6 +10,7 @@ use App\Events\UserCreated; use App\Events\UserDestroyed; use App\Events\UserDisabled; use App\Events\UserEnabled; +use App\Events\UserUpdated; use App\Models\News; use App\Models\Torrent; use App\Models\User; @@ -43,6 +44,7 @@ class FireEvent extends Command "user_destroyed" => ['event' => UserDestroyed::class, 'model' => User::class], "user_disabled" => ['event' => UserDisabled::class, 'model' => User::class], "user_enabled" => ['event' => UserEnabled::class, 'model' => User::class], + "user_updated" => ['event' => UserUpdated::class, 'model' => User::class], "news_created" => ['event' => NewsCreated::class, 'model' => News::class], ]; diff --git a/app/Events/UserUpdated.php b/app/Events/UserUpdated.php new file mode 100644 index 00000000..4c60c37b --- /dev/null +++ b/app/Events/UserUpdated.php @@ -0,0 +1,39 @@ +model = $model; + } + + /** + * Get the channels the event should broadcast on. + * + * @return \Illuminate\Broadcasting\Channel|array + */ + public function broadcastOn() + { + return new PrivateChannel('channel-name'); + } +} diff --git a/include/globalfunctions.php b/include/globalfunctions.php index 46ae172c..290ab2a8 100644 --- a/include/globalfunctions.php +++ b/include/globalfunctions.php @@ -1070,6 +1070,10 @@ function clear_user_cache($uid, $passkey = '') if ($passkey) { \Nexus\Database\NexusDB::cache_del('user_passkey_'.$passkey.'_content');//announce.php } + $userInfo = \App\Models\User::query()->find($uid, \App\Models\User::$commonFields); + if ($userInfo) { + fire_event("user_updated", $userInfo); + } } function clear_setting_cache()