I am writing the logic for an edit form and have some complications when displaying data in the inputs.
When I initially show the form, I show the records values like:
I solved that issue in my application if you want to get old previous inserted value in input you should try this one I did like this.
function SaveData(Request $request)
{
$sValidationRules = [
'firstname' => 'required',
'lastname' => 'required',
'email' => 'required',
'phone' => 'required',
];
$validator = Validator::make($request->all(), $sValidationRules);
if ($validator->fails()) // on validator found any error
{
// pass validator object in withErrors method & also withInput it should be null by default
return redirect('Your Route Hare')->withErrors($validator)->withInput();
}
Employee::create($request->all());
return redirect(' your route hare ');
}
& after then get old data in input field value like this using {{ Request::old('firstname') }} Happy Coding. :)