From 2d83b00d0142514eeaf81ebc064b9d5323cfd8ec Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Tue, 10 Jan 2023 20:45:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=20=E7=B1=BB?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Host.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/Models/Host.php b/app/Models/Host.php index a99b4e1..e55f71e 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -2,7 +2,7 @@ namespace App\Models; -use App\Events\UserEvent; +use App\Events\Users; use App\Jobs\Module\HostJob; use App\Models\WorkOrder\WorkOrder; use GeneaLabs\LaravelModelCaching\CachedBuilder; @@ -113,7 +113,7 @@ protected static function boot() }); static::created(function ($model) { - broadcast(new UserEvent($model->user_id, 'hosts.created', $model)); + broadcast(new Users($model->user_id, 'hosts.created', $model)); }); static::updating(function ($model) { @@ -133,7 +133,7 @@ protected static function boot() // $model->managed_price = round($model->managed_price, 2); // } - broadcast(new UserEvent($model->user_id, 'hosts.updating', $model)); + broadcast(new Users($model->user_id, 'hosts.updating', $model)); }); // when Updated @@ -143,12 +143,12 @@ protected static function boot() Cache::forget('user_hosts_' . $model->user_id); Cache::forget('user_tasks_' . $model->user_id); - broadcast(new UserEvent($model->user_id, 'hosts.updated', $model)); + broadcast(new Users($model->user_id, 'hosts.updated', $model)); }); // // static::deleting(function ($model) { - // broadcast(new UserEvent($model->user_id, 'hosts.deleting', $model)); + // broadcast(new Users($model->user_id, 'hosts.deleting', $model)); // }); static::deleting(function ($model) { @@ -156,7 +156,7 @@ protected static function boot() }); static::deleted(function ($model) { - broadcast(new UserEvent($model->user_id, 'hosts.deleted', $model)); + broadcast(new Users($model->user_id, 'hosts.deleted', $model)); Cache::forget('user_tasks_' . $model->user_id); Cache::forget('user_hosts_' . $model->user_id); }); @@ -298,7 +298,7 @@ public function cost($amount = null, $auto = true): bool $this->addLog($real_price); - broadcast(new UserEvent($this->user_id, 'balances.amount.reduced', $this->user)); + broadcast(new Users($this->user, 'balances.amount.reduced', $this->user)); if ($left < 0) { $this->update([