{{ Form::model($user, array('method' => 'put', 'action' => array('user.update', $user->id))) }}
<div class="form-group">
{{ Form::label('username','Username') }}
{{ Form::text('username',null,['class' => 'col-sm-2 form-control']) }}
</div>
<div class="form-group">
{{ Form::label('password','Password') }}
{{ Form::password('password',['class' => 'col-sm-2 form-control']) }}
</div>
<div class="form-group">
{{ Form::submit('Create user',['class' => 'btn btn-primary']) }}
</div>
{{ Form::close() }}
UserController.php
public function update($id)
{
$user = User::find($id);
$user->fill(Input::all());
$user->save();
return Redirect::to('/');
}
routes.php
Route::resource('user','UserController');
This may help.
Change you form tag to following code
{{ Form::open(array(
'action' => array('UserController@update', $user->id),
'method' => 'put'
)) }}
{{ From::model($user, [ 'route' => [ 'users.update', $user->id ], 'method' => 'put' ]) }}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community