Could not parse '29/10/1948': Failed to parse time string (29/10/1948)
i try to insert '29/10/1948' in date field, but i got this error
Could not parse '29/10/1948': Failed to parse time string (29/10/1948) at position 0 (2): Unexpected character
The error message suggests that there is an issue with parsing the date string '29/10/1948'. The format 'd-m-Y' is being used to parse the date, but the actual format of the date string is 'd/m/Y'. To fix this, you need to update the format used in the parse method.
This code uses the createFromFormat method of Carbon to parse the date string with the correct format 'd/m/Y'. Then, it formats the date as 'Y-m-d' before assigning it to the in_date attribute of the model.
Make sure to replace $request->in_date with the actual variable that holds the date string in your code.