如何使用更新资源控制器laravel 4? [英] How to use update Resource Controllers laravel 4?
本文介绍了如何使用更新资源控制器laravel 4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有带有索引,编辑,更新方法的客户控制器
I have Customer Controller with index, edit, update methods
Route::resource('customer', 'CustomerController');
控制器方法更新
public function update($id) { echo $id; }
我的HTML表单
<form action="/customer/1" method="post">
<input type="text" name="email" value="" />
<input type="submit" value="" />
</form>
我在这里关注了文档 http://four.laravel.com/docs/controllers#resource-controllers PUT/PATCH/资源/{id}更新
I have following a Documentation here http://four.laravel.com/docs/controllers#resource-controllers PUT/PATCH /resource/{id} update
似乎对我不起作用,如何使用?谢谢
It's seems not working for me, how to use it? thank you
推荐答案
要使用PATH
,PUT
或DELETE
HTML方法,您需要使用_method
添加隐藏的输入.像下面的...
To use the PATH
, PUT
or DELETE
HTML methods you need to add a hidden input with _method
. Like the following...
<input type="hidden" name="_method" value="PUT" />
这篇关于如何使用更新资源控制器laravel 4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文