Using eloquent, I am trying to get all users regardless of year who registered on February 28
OR 29
(in case of a leap year):
// If leap year, get feb 28 and 29 users
$users = \App\User::->whereMonth('created_at', '=', '02')
->whereDay('created_at', '=', '28')
->whereDay('created_at', '=', '29')
->get();
The above does not work when we add the extra 29
check here:
->whereDay('created_at', '=', '29') // does not work because of whereDay '28' above
Ideally something like this would work, but it does not exist in the api:
->whereDayIn('created_at', ['28','29'])
Any idea how to get the users for both days February 28
/29
?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire