改进 Task

This commit is contained in:
iVampireSP.com 2023-01-10 20:47:14 +08:00
parent a32723c8ec
commit bfe8a2e479
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\Exceptions\CommonException; use App\Exceptions\CommonException;
use Eloquent; use Eloquent;
use GeneaLabs\LaravelModelCaching\CachedBuilder; use GeneaLabs\LaravelModelCaching\CachedBuilder;
@ -110,7 +110,7 @@ protected static function boot()
// created // created
static::created(function ($model) { static::created(function ($model) {
$model->load('host'); $model->load('host');
broadcast(new UserEvent($model->user_id, 'tasks.created', $model)); broadcast(new Users($model->user_id, 'tasks.created', $model));
}); });
// updateing // updateing
@ -125,12 +125,12 @@ protected static function boot()
// Cache::forget('user_tasks_' . $model->user_id); // Cache::forget('user_tasks_' . $model->user_id);
$model->load('host'); $model->load('host');
broadcast(new UserEvent($model->user_id, 'tasks.updated', $model)); broadcast(new Users($model->user_id, 'tasks.updated', $model));
}); });
static::deleted(function ($model) { static::deleted(function ($model) {
broadcast(new UserEvent($model->user_id, 'tasks.deleted', $model)); broadcast(new Users($model->user_id, 'tasks.deleted', $model));
}); });
} }