Please add a groupBy method

Hi, John! How difficult is to add a groupBy() method to GCE? It would be a nice companion to defaultOrdering().
Thanks.

Hello @bgeneto ,

groupBy is a more complicated one since it is changing the number of rows. For now maybe you can create a custom model with any extra more complicated queries. For example a custom model that can look like the example here: setModel | Grocery CRUD v3

<?php 

use GroceryCrud\Core\Model;

class customModel extends Model {

    public function extraWhereStatements($select)
    {
        // please keep in mind that the syntax is from lamina-db
        $select->group('category');
        return $select;
    }

}

As I am not sure if this will work out of the box, maybe you need to create a more complicated customModel as per example here: Custom Model | Grocery CRUD v3

I will have it in mind though maybe to have the groupBy as a future implementation.

Regards
Johnny