<?php

namespace App\Http\Controllers\Function;

use App\Http\Controllers\Controller;
use Illuminate\Support\Carbon;

class GetAgeController extends Controller
{
    public function getAge(?string $birthDate)
    {
        $birthDate = Carbon::parse($birthDate);
        $today = Carbon::now();

        return $birthDate->diffInYears($today);
    }
}
