From b2e7e298892d29cf9378bba1e8ecae6e8407c5a5 Mon Sep 17 00:00:00 2001 From: "iVampireSP.com" Date: Sat, 10 Sep 2022 12:05:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Host.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Models/Host.php b/app/Models/Host.php index 6ec7f0f..ca78c38 100644 --- a/app/Models/Host.php +++ b/app/Models/Host.php @@ -183,6 +183,8 @@ protected static function boot() // when Updated static::updated(function ($model) { dispatch(new \App\Jobs\Remote\Host($model, 'patch')); + + Cache::forget('user_hosts_' . $model->user_id); }); // // when delete @@ -191,5 +193,9 @@ protected static function boot() // // dispatch(new \App\Jobs\Remote\Host($model, 'delete')); // }); + + static::deleted(function ($model) { + Cache::forget('user_hosts_' . $model->user_id); + }); } }