我的控制器
public function update($id)
{
if (!is_numeric($id)) {
// @codeCoverageIgnoreStart
return \App::abort(404);
// @codeCoverageIgnoreEnd
}
$temp = Input::all();
$temp['password'] = Hash::make($temp['password']);
//form Processing
$result = $this->userForm->update($temp);
//$result = $this->userForm->update(Input::all());
if ($result['success']) {
// Success!
Session::flash('success', $result['message']);
return Redirect::action('UserController@index', array($id));
} else {
Session::flash('error', $result['message']);
return Redirect::action('UserController@edit', array($id))
->withInput()
->withErrors($this->userForm->errors());
}
}
我的观点
<div class="form-group {{ ($errors->has('firstName')) ? 'has-error' : '' }}" for="firstName">
{{ Form::label('edit_firstName', 'First Name', array('class' => 'col-sm-2 control-label')) }}
<div class="col-sm-10">
{{ Form::text('firstName', $user->first_name, array('class' => 'form-control', 'placeholder' => 'First
Name', 'id' => 'edit_firstName'))}}
</div>
{{ ($errors->has('firstName') ? $errors->first('firstName') : '') }}
</div>
<div class="form-group {{ ($errors->has('lastName')) ? 'has-error' : '' }}" for="lastName">
{{ Form::label('edit_lastName', 'Last Name', array('class' => 'col-sm-2 control-label')) }}
<div class="col-sm-10">
{{ Form::text('lastName', $user->last_name, array('class' => 'form-control', 'placeholder' => 'Last Name',
'id' => 'edit_lastName'))}}
</div>
{{ ($errors->has('lastName') ? $errors->first('lastName') : '') }}
</div>
@if (Sentry::getUser()->hasAccess('admin'))
<div class="form-group">
{{ Form::label('edit_memberships', 'Group Memberships', array('class' => 'col-sm-2 control-label'))}}
<div class="col-sm-10">
@foreach ($allGroups as $group)
<label class="checkbox-inline">
<input type="checkbox" name="groups[{{ $group->id }}]" value='1'
{{ (in_array($group->name, $userGroups) ? 'checked="checked"' : '') }} > {{ $group->name }}
</label>
@endforeach
</div>
</div>
<div class="form-group {{ ($errors->has('password')) ? 'has-error' : '' }}">
{{ Form::password('password', array('class' => 'form-control', 'placeholder' => 'Password')) }}
{{ ($errors->has('password') ? $errors->first('password') : '') }}
</div>
@endif
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
{{ Form::hidden('id', $user->id) }}
{{ Form::submit('Submit Changes', array('class' => 'btn btn-primary'))}}
</div>
</div>
{{ Form::close()}}</div>
我正在尝试更新数据配置文件;名字,姓氏,会员和密码。
我无法更新此密码,我的加密密码如:
$2y$10$mjkd5MRgUEn2JSK52xrrQ.bpDz5WZwAaHje6gd0TbmH7h4H3.7BBO