title: Laravel 4 validator for password field in edit account
body: <p>I need to check if a user has posted the same password as the one in the database. Field for old password is 'oldpass'. The custom validator i created is called 'passcheck'. It should fail or pass accordingly.</p>
  
  <p>My UsersController code below doesnt work. What could have I have done wrong? </p>
  
  <pre><code>    $rules = array(
          'oldpass'   =&gt;  'passcheck',
      );
  
      $messages = array(
          'passcheck' =&gt; 'Your old password was incorrect',
      );
  
  
      Validator::extend('passcheck', function($attribute, $value, $parameters)
      {
          if(!DB::table('users')-&gt;where('password', Hash::make(Input::get('oldpass')))-&gt;first()){
              return false;
          }
          else{
              return true;
          };
      });
  
      $validator = Validator::make($inputs, $rules, $messages);
  </code></pre>