In a controller, I am validating the input of the fields of a registration form. I am doing simple validation such as required fields, email validation etc.
When I get a successful submit, I then go on to attempt to create the user (I am using the Sentry package). I want to be able to catch the errors from this process and then append them to the validation errors and attach them to specific fields. For example: if the email already exists, I want to insert an error to the 'email field' and give it a custom error message.
I was hoping there was some easy way to do this, such as (pseudo-code):
$validation->error()->insert_error($field_name, $message)
Any easy way of doing this?