I have this validation code that check if my input is a valid image with max size of 2048:
$request->validate([
'file' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
]);
If the validation doesn't pass, I'd like to return a response in JSON format, how could I do that?