I am using laravel 5.4 I am validating the form with the Valitador:make
, what I want to know is that when a failure occurs and I go back I could show the value that the fields had before to reload the page, instead of empty input
.
This is the code that I use for the validations in the user's driver when entering a new user
$messages = [
'unique' => 'El :attribute ya existe',
];
$validator = Validator::make($request->all(), [
'username' => 'required|unique:users|max:255',
'email' => 'required|unique:users|max:255',
], $messages);
if ($validator->fails()) {
return redirect('users')->withErrors($validator, 'SaveUser')->withInput();
}