2
I want to calculate the age through the date of birth, I will leave the processing in the database, I am new in Laravel and I am not able to execute the following query:
SELECT YEAR(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(dataNascimento))) AS idade FROM pessoas
my code is more or less like this:
return view('pessoas.grafico-idade', array('pessoas' => Pessoa::select('pessoa')->select('dataNascimento','YEAR(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(dataNascimento))) AS idade')->get()));
@Virgilionovic I’ve looked at this quest before I open this question, I’m trying to do in Laravel. But I’ve already solved it here anyway.
– Sr. Bigode