Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1.  
  2.  
  3.     /**
  4.      * Validates the current user model's data.
  5.      *
  6.      * [!!] Removes password checks if not changed, and then puts them back in afterwards
  7.      *
  8.      * @return  boolean
  9.      */
  10.     public function check()
  11.     {
  12.         if ( ! array_key_exists('password', $this->_changed))
  13.         {
  14.             // Tmp store password rules
  15.             $annoying = Arr::extract($this->_rules, array('password', 'password_confirm'));
  16.  
  17.             // Unset
  18.             unset($this->_rules['password'], $this->_rules['password_confirm']);
  19.  
  20.             // Check
  21.             $result = parent::check();
  22.  
  23.             // Put back in
  24.             $this->_rules += $annoying;
  25.  
  26.             // Return result
  27.             return $result;
  28.         }
  29.  
  30.         return parent::check();
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement