在 laravel 5 中的表单请求验证后传递旧输入 [英] Pass old input after Form Request validation in laravel 5

查看:28
本文介绍了在 laravel 5 中的表单请求验证后传递旧输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果验证失败,我不清楚如何传递旧输入以再次填写表单.

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

我的意思是,我知道如何在使用 Validator 类时传递数据,并在使用 withInput() 方法失败后重定向,但我正在尝试学习如何使用 laravel 5 中提供的表单请求.谢谢

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

推荐答案

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

或在视图中:

{{ old('username') }}

阅读更多:http://laravel.com/docs/5.0/requests#old-输入

这篇关于在 laravel 5 中的表单请求验证后传递旧输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆