How to count underage employees?

1

I use the following code to display the number of active employees:

{{ $relatorio->Empresa->Funcionario->where('id_status', 1)->count() }}

How do I count only employees who are under the age of 18?

In the employee table I have the date of birth in the format date "2000-09-23"

    
asked by anonymous 13.07.2016 / 15:28

1 answer

0

Most databases, where clauses accept more than one parameter. Cassi was you who made this select class, make sure it accepts more parameters. This second parameter would be: SELECT * FROM table WHERE id_status = 1 and colunaDataNascimento::date < '".dates("Y-m-d",strtotime ("-18 years"))."' -- deve estar em ISO-8601 format, YYYY-MM-DD

    
13.07.2016 / 16:13