Hello, I would like to reflect the number of days of an absent worker from his date of absence either using Carbon or something native in php, use Laravel the example is this:
In the BD I consult the absenteeism that said worker has
$ausentismo_anual_dias = $empresa->ausentismo()
->whereYear('fecha_ausente', Carbon::now()->format('Y'))
->get();
In a foreach cycle I want to print from your date absence example
foreach($ausentismo_anual_dias as $row){
//Aqui quiero calcular los dias de ausencias
}
Note days of absence must be calculated by month example This worker is absent from the given date 2018-10-06 (Month October) to the end date of the month October 2018-10-31 has 25 days absent, then we go to November 2018-11-01 to the current date 2018-11-05 you have that 5 days elapsed > All this must be covered from the cycle
showing it like this:
October: 25 days absent
November: 5 days absent
December should not show since we are not in that month so it should be in 0 days
I hope you can help me with this request