laravel api fields rules send error code example
Example: how to add an custom error to validater error in laravel
if (request('event') == null) {
$validator->errors()->add('event', 'Please select an event');
}
if (request('event') == null) {
$validator->errors()->add('event', 'Please select an event');
}