How to user PostgreSQL function in ORM?

If I execute this code:

$users = Users::count([
    'group' => 'date_trunc("day", register_date) as date',
    'order' => 'date desc',
]);

I get error, maybe I can user ORM for my example, not use raw sql.

What error you have? I just guess you need to add dialect extension check for example this:

https://github.com/phalcon/incubator/blob/master/Library/Phalcon/Db/Dialect/MysqlExtended.php