I have a quite simple problem.. I use the Carbon::parse($date)
function with $date = \'15.15.2015\'
. Of course it can not return a valid string because
another solution would be to handle the exception globally.
use Carbon\Exceptions\InvalidFormatException;
if ($exception instanceof InvalidFormatException) {
return response()->json([
'status' => 'fail',
'data' => [
'message' => 'Invalid date formate!'
]
], 400);
}