Laravels fluent query markup makes life real easy, too easy sometimes. Getting $query->groupBy(‘column’)->count() to spit out the correct count for the recordset instead of the total before the aggregate took me a few minutes to figure out, so I thought I’d share. Imagine the following were rows of the Persons table: ['name' => 'Tom', 'age' […]
The post Laravel: Get the right totals using aggregate queries such as count(), avg(), etc appeared first on CodeBlog.