Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pass old input after Form Request validation in laravel 5

if the validation fails it's not clear to me how i could pass the old input to fill again the form.

I mean, I know how to pass the data when using the Validator class and redirecting after fail with the method withInput(), but I'm trying to learn how to use Form Requests provided in laravel 5. Thanks

like image 351
GabAntonelli Avatar asked Mar 23 '15 15:03

GabAntonelli


2 Answers

$username = Request::old('username');

or in view:

{{ old('username') }}

Read more: http://laravel.com/docs/5.0/requests#old-input

like image 76
Limon Monte Avatar answered Sep 28 '22 01:09

Limon Monte


You can redirect with old data like below with validation error

return redirect()->back()->withErrors($validator)->withInput();
like image 27
Naveen Gaur Avatar answered Sep 28 '22 02:09

Naveen Gaur