File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -56,8 +56,11 @@ public function run(): View
5656 $ differenceArticle = $ currentMonthArticles - $ lastMonthArticles ;
5757
5858 $ totalViews = views (Article::class)->count ();
59- $ lastMonthViews = views (Article::class)->period (Period::pastMonths (1 ))->count ();
60- $ currentViews = views (Article::class)->period (Period::create (now ()->startOfMonth ()))->count ();
59+ $ lastMonthViews = views (Article::class)
60+ ->period (Period::create (now ()->subMonth ()->startOfMonth (), now ()->subMonth ()->endOfMonth ()))
61+ ->remember (now ()->addMonth ())
62+ ->count ();
63+ $ currentViews = views (Article::class)->period (Period::upto (now ()->startOfMonth ()))->count ();
6164 $ differenceViews = $ currentViews - $ lastMonthViews ;
6265
6366 return view ('widgets.recent_numbers ' , [
You can’t perform that action at this time.
0 commit comments