phplaravelrouteslaravel-4controllers

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


Solution

  • 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" />