jeudi 4 février 2016

issues with whereRaw in Laravel

I am trying to add this condition in my query.

$query->whereRaw('DATE(product_cheques.deposit_date) BETWEEN ? AND ?', [strval($this->getTodayDate()->format('Y-m-d')), strval($this->addSevenDayBucket()->format('Y-m-d'))]);

I don't get any output when I run this. However, when I run the same query that ORM has executed

DATE(product_cheques.deposit_date) BETWEEN ? AND ?
[0] - 2016-02-01
[1] - 2016-02-15

with adding quotes to date field, I get the desired result.

where DATE(product_cheques.deposit_date) BETWEEN '2016-02-01' AND '2016-02-15'

How can I modify my Eloquent query?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1o95CbD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire