I m trying to filter my document on created_at with whereMonth/whereYear clauses. But it always returns empty collection. I can’t understand why.
Example :
$collection = MyModel::whereMonth('created_at', '06')->get();
I tried to change type of parameter with ‘6’ or (int) 6… but nothing changed.
Someone to explain me why it doesn’t work as documentation says (jenssegers package or laravel).
I didn’t found any solution…
Thank you.
2
Answers
Ok i found solution. I made my query in a whereRaw and used this :
Same for requesting "year".
Thanks for all.