class Patients extends Model
{
protected $appends = ['age'];
/**
* Get the patients's age.
*
* @param string $value
* @return string
*/
public function getAgeAttribute($value)
{
$age = (time() - strtotime($this->dobDay.' '.$this->dobMonth.' '. $this->dobYear)) / (60 * 60 * 24 * 365);
$age = floor($age);
return $age;
}
}