Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use update Resource Controllers laravel 4?

I have Customer Controller with index, edit, update methods

Route::resource('customer', 'CustomerController');

Controller methods update

public function update($id) { echo $id; }

my HTML Form

<form action="/customer/1" method="post">
<input type="text" name="email" value="" />
<input type="submit" value="" />
</form>

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

like image 448
Joanhard Avatar asked Mar 05 '13 01:03

Joanhard


1 Answers

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" />
like image 124
Robbo Avatar answered Oct 02 '22 03:10

Robbo