Since you are using 4.1
so it should be {id}
not (:any)
and make sure you are using the right way to generate form, like this:
Form::open(array('action' => array('AuthorsController@put_update', $author->id), 'method' => 'put'))
Also close the form using Form::close()
. Since you are not using a RESTful
controller so you can use a method name as update
instead of put_update
and for RESTful
method use putUpdate
not put_update
. So, you may use a route like:
Route::put('authors/update', array('uses'=>'AuthorsController@update'));
Then the method should be:
public function update($id)
{
// ...
if ($validation->fails()){
return Redirect::back()->withInput()->withErrors($validation);
}
else{
Author::update($id, $author);
return Redirect::route('view_author', $id);
}
}
So the form should be like:
Form::open(array('action' => array('AuthorsController@update', $author->id), 'method' => 'put'))
Also change your edit route
to this:
Route::get('authors/edit/{id}', array('as'=>'edit_author', 'uses'=>'AuthorsController@edit'));
Make the change in the method as well:
public function edit($id)
{
//...
}