From 29f2c50e2e233f191f7ba081769f477625629d65 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 27 Dec 2022 04:16:34 -0700 Subject: [PATCH] Update StatusHashtagObserver --- app/Observers/StatusHashtagObserver.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Observers/StatusHashtagObserver.php b/app/Observers/StatusHashtagObserver.php index 5c7aa7d45..fa38ea3c3 100644 --- a/app/Observers/StatusHashtagObserver.php +++ b/app/Observers/StatusHashtagObserver.php @@ -2,6 +2,7 @@ namespace App\Observers; +use DB; use App\StatusHashtag; use App\Services\StatusHashtagService; @@ -23,6 +24,7 @@ class StatusHashtagObserver public function created(StatusHashtag $hashtag) { StatusHashtagService::set($hashtag->hashtag_id, $hashtag->status_id); + DB::table('hashtags')->where('id', $hashtag->hashtag_id)->increment('cached_count'); } /** @@ -45,6 +47,7 @@ class StatusHashtagObserver public function deleted(StatusHashtag $hashtag) { StatusHashtagService::del($hashtag->hashtag_id, $hashtag->status_id); + DB::table('hashtags')->where('id', $hashtag->hashtag_id)->decrement('cached_count'); } /**