22 lines
474 B
PHP
22 lines
474 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Geral;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Geral\AgeService;
|
|
use Carbon\Carbon;
|
|
|
|
class DiferencaTempoController extends Controller
|
|
{
|
|
public function calc($year, $month, $day)
|
|
{
|
|
$diff = AgeService::getAge(Carbon::create($year, $month, $day)->toDateTime());
|
|
|
|
return [
|
|
'anos' => $diff->years,
|
|
'meses' => $diff->months,
|
|
'dias' => $diff->days
|
|
];
|
|
}
|
|
}
|