具有页面重定向的路由中的表单提交/验证-Laravel
在我的刀片文件中具有页面重定向的路由中的表单提交/验证-Laravel,laravel,Laravel,在我的刀片文件中 <form id="" class="form-horizontal" accept-charset="UTF-8" action="/apply/post/{{$content->vacancy->Id}}" method="POST"> 无论我在提交表单时尝试什么Redirect::to(),即Redirect::back(),我最终都会被重定向回http://example.co.uk/ap
<form id=""
class="form-horizontal"
accept-charset="UTF-8"
action="/apply/post/{{$content->vacancy->Id}}"
method="POST">
无论我在提交表单时尝试什么Redirect::to()
,即Redirect::back()
,我最终都会被重定向回http://example.co.uk/apply/post/234
这会导致我进入未定义的路线和错误页面
如果用户验证失败,我真的希望他们重定向回http://example.co.uk/apply/234
显示错误/消息。通过这种方式,他们可以重新尝试输入正确的信息,最终将表单提交到http://example.co.uk/apply/post/234
说吧
不要问,我继承了代码,我的Laravel是初学者,但这是否可能使用框架呢?您可以从表单发布到路线
method="POST"
但是你的路线被定义为GET
Route::get('/apply/post/{ref}', function($ref) {
改成POST
Route::post('/apply/post/{ref}', function($ref) {
谢谢我尝试使用
Route::post()http://example.co.uk/apply/{$ref}”)->withInput()->withErrors($messages)代码>
Route::post('/apply/post/{ref}', function($ref) {