You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
I want to implement a custom error message, my question is very similar to this #145 except for the fact that I need an additional layer of validation even when the normal validation rules are respected.
At the moment I solved in this way
`$form->saved(function () use ($form) {
$get_record = DB::table('my_table')->where('fk_key_1', $form->model->fk_key_1)->
where('fk_key_2', $form->model->fk_key_2)->where('type', $form->model->type)->first();
if ($get_record->id) {
$form->message("There is another record with the same properties, so the record was not saved.");
$cancella = DB::table('my_table')->where('id', $form->model->id)->delete();
$form->link("/my_controller/edit?modify=" . $get_record->id, "Edit the existing record");
} else {
$form->message("Record saved");
$form->link("/my_controller/edit?modify=" . $form->model->id,"Edit the record");
}
});`
but it's not so elegant, nor efficient, to delete a record after the insertion. Do you have any suggestions?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
hi,
I want to implement a custom error message, my question is very similar to this #145 except for the fact that I need an additional layer of validation even when the normal validation rules are respected.
At the moment I solved in this way
but it's not so elegant, nor efficient, to delete a record after the insertion. Do you have any suggestions?
The text was updated successfully, but these errors were encountered: