I have a Laravel model, Users
. It utilizes standard Laravel's timestamp: created_at
and updated_at
.
I want to find Users created on the same date as the given user.
The problem is I can't directly compare database fields, as those fields also contain the time, like so: 2016-03-27 14:46:30
.
I want to do somehting like this:
User::where('created_at', $user->created_at);
But it doesn't seem to work that way.
Any suggestions?
Try to use whereDate
condition instead :
$q->whereDate('created_at', '=', $your_date);
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With