problems with returning inputs. after form submitted, if validator fails it doesnt return 'old' inputs. here's my controller
$validator = Validator::make($request->all(), [
'user_rate' => 'required|integer|between:1,5',
'user_comment' => 'required',
], [
"user_rate.integer" => trans('errors.rate-required'),
"user_rate.between" => trans('errors.rate-required'),
"user_rate.required" => trans('errors.rate-required'),
"user_comment.required" => trans('errors.com-required'),
]);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator)->withInput($request->input());
//return redirect()->back()->with(Input::all());
}
i have tried several ways(also $request->flash(), but it doesnt return 'old' inputs
In your controller
public function someFunction(Request $request)
{
//Validation Logic
if($v->fails())
{
return redirect()->back()->withInput();
}
}
In your view
<input type="text" name="some_name" value="{{old('some_name')}}">
Hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With