@@ -310,27 +310,27 @@ public function replies(): Collection
310310
311311 public function countReplies (): int
312312 {
313- return Cache:: remember ( ' replies_count ' , now ()-> addHours ( 2 ), fn () => $ this ->replyAble ()->count () );
313+ return $ this ->replyAble ()->count ();
314314 }
315315
316316 public function countSolutions (): int
317317 {
318- return Cache:: remember ( ' solutions_count ' , now ()-> addHours ( 2 ), fn () => $ this ->replyAble ()->isSolution ()->count () );
318+ return $ this ->replyAble ()->isSolution ()->count ();
319319 }
320320
321321 public function countArticles (): int
322322 {
323- return Cache:: remember ( ' articles_count ' , now ()-> addHours ( 2 ), fn () => $ this ->articles ()->approved ()->count () );
323+ return $ this ->articles ()->approved ()->count ();
324324 }
325325
326326 public function countDiscussions (): int
327327 {
328- return Cache:: remember ( ' discussions_count ' , now ()-> addHours ( 2 ), fn () => $ this ->discussions ()->count () );
328+ return $ this ->discussions ()->count ();
329329 }
330330
331331 public function countThreads (): int
332332 {
333- return Cache:: remember ( ' threads_count ' , now ()-> addHours ( 2 ), fn () => $ this ->threads ()->count () );
333+ return $ this ->threads ()->count ();
334334 }
335335
336336 public function scopeMostSolutions (Builder $ query , int $ inLastDays = null )
@@ -371,12 +371,13 @@ public function scopeMostSubmissionsInLastDays(Builder $query, int $days)
371371 public function scopeWithCounts (Builder $ query )
372372 {
373373 return $ query ->withCount ([
374+ 'discussions as discussions_count ' ,
374375 'articles as articles_count ' ,
375376 'threads as threads_count ' ,
376377 'replyAble as replies_count ' ,
377378 'replyAble as solutions_count ' => function (Builder $ query ) {
378379 return $ query ->join ('threads ' , 'threads.solution_reply_id ' , '= ' , 'replies.id ' )
379- ->where ('replyable_type ' , Thread::class );
380+ ->where ('replyable_type ' , ' thread ' );
380381 },
381382 ]);
382383 }
0 commit comments