In reference to this stockoverflow question
I created a new request with php artisan make:request ApplicationFormRequest
public function rules() {
return ['first_name' => 'required']
}
I also have a controller as such,
public function store(ApplicationFormRequest $request){
//empty
}
I have seen an example on stackoverflow with
return Redirect::to('/')->withInput();
they seem to put their validation together with the controller, but I am not sure how to go about it this way.
Where would I put that? How do I retrieve old input even with validation fail?
EDIT you see my controller is empty, it validate automatically with the rule i set at ApplicationFormRequest. when it failed it automatically redirect to the view where the input is submitted with error
@foreach ($errors->all() as $error)
<li class="alert label">{{$error}}</li>
@endforeach
but I am unable to fill the input with the input user just submitted, I try to do
<input type="text" value="{{ old('first_name') }}" \>
but this give me error Use of undefined constant