From a37971dd2823b184b9813e28a9bfc3d1bd6aed72 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 Dec 2021 17:31:53 -0700 Subject: [PATCH] Add HashtagService --- app/Services/HashtagService.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 app/Services/HashtagService.php diff --git a/app/Services/HashtagService.php b/app/Services/HashtagService.php new file mode 100644 index 00000000..6a40595d --- /dev/null +++ b/app/Services/HashtagService.php @@ -0,0 +1,32 @@ + $tag->name, + 'slug' => $tag->slug, + ]; + }); + } + + public static function count($id) + { + return Cache::remember('services:hashtag:count:by_id:' . $id, 3600, function() use($id) { + return StatusHashtag::whereHashtagId($id)->count(); + }); + } + +}