重命名 类名

This commit is contained in:
iVampireSP.com 2023-01-10 20:45:07 +08:00
parent 2564593120
commit 2d83b00d01
No known key found for this signature in database
GPG Key ID: 2F7B001CA27A8132

View File

@ -2,7 +2,7 @@
namespace App\Models; namespace App\Models;
use App\Events\UserEvent; use App\Events\Users;
use App\Jobs\Module\HostJob; use App\Jobs\Module\HostJob;
use App\Models\WorkOrder\WorkOrder; use App\Models\WorkOrder\WorkOrder;
use GeneaLabs\LaravelModelCaching\CachedBuilder; use GeneaLabs\LaravelModelCaching\CachedBuilder;
@ -113,7 +113,7 @@ protected static function boot()
}); });
static::created(function ($model) { 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) { static::updating(function ($model) {
@ -133,7 +133,7 @@ protected static function boot()
// $model->managed_price = round($model->managed_price, 2); // $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 // when Updated
@ -143,12 +143,12 @@ protected static function boot()
Cache::forget('user_hosts_' . $model->user_id); Cache::forget('user_hosts_' . $model->user_id);
Cache::forget('user_tasks_' . $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) { // 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) { static::deleting(function ($model) {
@ -156,7 +156,7 @@ protected static function boot()
}); });
static::deleted(function ($model) { 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_tasks_' . $model->user_id);
Cache::forget('user_hosts_' . $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); $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) { if ($left < 0) {
$this->update([ $this->update([