1
I need to make an appointment at the bank to see the birthday of the current month. A consultation of this type, see:
SELECT * FROM membros WHERE day(dataNasc) = day(CURRENT_DATE) and month(dataNasc) = month(CURRENT_DATE);
How could I make that appointment at Laravel?
I tried to make it that way but it’s coming back dates that aren’t from today (that in the case today 03/09/2017). For it comes back as 04/09
, 05/09
, etc..
See how I’m trying :
$date = Membro::all();
foreach ($date as $d) {
$explode = explode('-', $d->dataNasc);
}
$query = DB::table('membros')
->whereDay('dataNasc', $explode[2])
->whereMonth('dataNasc', $explode[1])
->get(['nome', 'imagem']);
dd($query);
It returns me 4 values. where only 3 values are according to the current date at the moment, but if I go to phpmyadmin
and put the command
SELECT * FROM membros WHERE day(dataNasc) = day(CURRENT_DATE) and month(dataNasc) = month(CURRENT_DATE);
He returns to me only the 3 correct values of current date and current month? How can I resolve this?