Php 更新Laravel4中的哈希密码

Php 更新Laravel4中的哈希密码,php,laravel-4,Php,Laravel 4,我希望用户能够更新自己的密码。我得到三个输入,而在数据库中,我有密码字段以及用户名和电子邮件。我真的不知道控制器的流程,希望你能帮助我 我的控制器: public function changepass() { $user = Auth::user(); $rules = array( 'old_password' => 'required|alphaNum|between:4,16', 'password' => 'required

我希望用户能够更新自己的密码。我得到三个输入,而在数据库中,我有密码字段以及用户名和电子邮件。我真的不知道控制器的流程,希望你能帮助我

我的控制器:

public function changepass() {

    $user = Auth::user();
    $rules = array(
        'old_password' => 'required|alphaNum|between:4,16',
        'password' => 'required|alphaNum|between:4,16|confirmed'
    );

    $validator = Validator::make(Input::all(), $rules);

    if ($validator->fails()) {
        return Redirect::action('HomeController@getpass', $user->id)->withErrors($validator);
    } else {
        if (!Hash::check(Input::get('old_password'), $user->password)) {
            return Redirect::action('HomeController@getpass', $user->id)->withErrors('Old password does not match!');
        } else {
            $user->password = Hash::make(Input::get('password'));
            $user->save();
            return Redirect::action('HomeController@getpass', $user->id)->withMessage("Password has been changed successfully!");
        }
    }
我的看法是:

@extends('master')
@section('content')

<div class="span8 well" style="opacity: 0.9">

<h4>Change password: </h4>

{{ Form::open(array('url' => 'changepass/', 'method'=>'POST')) }}

{{Form::hidden('id',Auth::user()->id)}}

<div class="form-group">
    {{ Form::password('old_password', array('class'=>'form-control', 'placeholder'=>'Old Password')) }}<br>
    {{ Form::password('new_password', array('class'=>'form-control', 'placeholder'=>'New Password')) }}<br>
    {{ Form::password('confirm_new_password', array('class'=>'form-control', 'placeholder'=>'Confirm New Password')) }}
</div>

{{ Form::submit('Update', array('class' => 'btn btn-success')) }}


</div>
@stop

如果(Hash::check())不是
,则应该是
!Hash::check()
有什么问题?
 Route::post('changepass', 'HomeController@changepass');