From 771f9c461558e2e4a2a5a854648982699918bece Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 18 Oct 2019 13:40:56 -0600 Subject: [PATCH] Update FixLikes command, fix postgres support --- app/Console/Commands/FixLikes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/FixLikes.php b/app/Console/Commands/FixLikes.php index adb4ee454b..0209f66b00 100644 --- a/app/Console/Commands/FixLikes.php +++ b/app/Console/Commands/FixLikes.php @@ -40,7 +40,7 @@ public function __construct() public function handle() { $chunk = 100; - $limit = Like::groupBy('status_id')->get()->count(); + $limit = Like::select('status_id')->groupBy('status_id')->get()->count(); if($limit > 1000) { if($this->confirm('We have found more than 1000 records to update, this may take a few moments. Are you sure you want to continue?') == false) { @@ -56,7 +56,7 @@ public function handle() $bar->start(); Like::selectRaw('count(id) as count, status_id') - ->groupBy('status_id') + ->groupBy(['status_id','id']) ->chunk($chunk, function($likes) use($bar) { foreach($likes as $like) { $s = Status::find($like['status_id']);