The four-digit year could not be found. Data not available in Carbon

InvalidArgumentException: A four digit year could not be found
Data missing in carbon/src/Carbon/Carbon.php:425

      

Getting this error in my apache logs. What is the reason for this type of error?

+3


source to share


2 answers


Running it on a date should fix it first. You will probably get an invalid date from the front-end.

function validateDate($date, $format = 'Y-m-d H:i:s'){
    $d = DateTime::createFromFormat($format, $date);
    return $d && $d->format($format) == $date;
}

      



Function

was copied from this or php.net

+2


source


I ran into and fixed this issue and the problem was that I was using the protect method in the eloquent model and then I was trying to save the data using the create method. The problem was that the array I provided to create the method as a parameter had an extra column separate from the table column, so somehow our outrage was caused by the created_at or updated_at field. Once I fixed the additional column problem. The error has been removed.



0


source







All Articles