Hi, guys.
Why the database interaction with Capsule, isn't working the same way as in Laravel ?
Capsule::table('tblinvoices')->where('status', 'Unpaid')->where('duedate', '<=', 'DATE(DATE_ADD(NOW(), INTERVAL -2 DAY))')->get()
When I use this statement, I'm getting invoices that I'm not supposed to, because it is ignoring the "<=" operator, any thoughts of why is this ?
Also tried this one:
Capsule::table('tblinvoices')->where([
['status','=','Unpaid'],
['duedate', '<=', 'DATE(DATE_ADD(NOW(), INTERVAL -2 DAY))'],
])->get()
Where the result is still the same, getting invoices with a duedate of 2017/04/02 when it wasn't supposed to happen.
Ok, I could only fix it, by using whereRaw():
Capsule::table('tblinvoices')->whereRaw("status = 'Unpaid' AND duedate <= DATE(DATE_ADD(NOW(), INTERVAL -2 DAY))")->get()
But actually, it was supposed to work the way I've shown above before, wasn't it ?