2014-01-31 89 views
0

驗證規則後,我想檢查database.and保存散列密碼我使用這下面的代碼當前照耀處的密碼寬度,但我得到的錯誤:Laravel類「HASH」未找到

錯誤代碼:

Symfony \ Component \ Debug \ Exception \ FatalErrorException 

Class 'HASH' not found 

我的控制器動作:

public function update($id) 
{ 
    $rules = array(
     'name'  => 'required|alpha', 
     'family'  => 'required', 
     'email'  => 'required', 
     'password' => 'required|confirmed', 
     'password_confirmation'=>'required', 
    ); 

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

    if ($validator->fails()) { 
     return Redirect::to('/admin/profile') 
      ->withErrors($validator) 
      ->withInput(); 
    } 
    else 
    { 
     $currentPassword = User::find($id); 
     if ($currentPassword == HASH::make(Input::get('currpassword'))){ 
      return Redirect::route('/admin/profile') 
       ->with('message', 'Password Match Error') 
       ->withInput(); 
     } 

    } 
} 
+0

它的哈希不是HASH – intelis

回答

4

應該Hash::make,不HASH::make

0
在你的控制器文件

添加在頂部

use Hash 
// and use Hash::make instead of HASH::make 
Hash::make(Input::get('currpassword'))