MySQL Functions


I have the code below:

        .where('payments.agent', '=', agent_uid)
        .where('MONTH(due_date)', '=', month)

The MONTH function is a standard function of MySQL, but when I use in where clause, the sql script generated include ``, look.
Script generated:

where `payments`.`agent` = 1 and `MONTH(due_date)` = \'3\'

Script I wish:

where `payments`.`agent` = 1 and MONTH(`due_date`) = \'3\'

How can I do this?


I found it.
I can use database.raw to write scripts directly, so the line code will be like this:

.where(database.raw('MONTH(payments.due_date)'), '=', month)



The .where() function just accept the model/table as first parameter.

You can mark the problem as solved?