Reputation: 2790
I have defined route in Route File as :
Route::get('user/update','Users@Update');
I want to fill my model data to form so i am writing form::model
<?php echo Form::model($users,array('route' => array('user.update', $users->id))) ?>
It show me error :
Route [user.update] not defined.
If i write
<?php echo Form::model($users) ?>
Then it is working perfectly.
Upvotes: 0
Views: 2534
Reputation: 25445
The default method created by the Form class is "POST", so you need:
1) to name the route (as correctly pointed out by @Joel);
2) to make it answer to the proper HTTP verb:
Route::post('user/{id}/update',['as' => 'user.update', 'uses' => 'Users@Update']);
If you're using it for both GET and POST, use the any
method:
Route::any('user/{id}/update',['as' => 'user.update', 'uses' => 'Users@Update']);
Upvotes: 2