Skip to content

Instantly share code, notes, and snippets.

@icambridge
Created February 29, 2012 18:52
Show Gist options
  • Save icambridge/1943493 to your computer and use it in GitHub Desktop.
Save icambridge/1943493 to your computer and use it in GitHub Desktop.
Change the validation rules
<?php
$user = User:create();
// Get the validation rules.
$userModel = new User();
$rules = $userModel->validates;
// Add new
$rules['password']['skipEmpty'] = true;
$rules['confirm_password'] = array(
'match',
'message' => 'The passwords need to match',
'other_field' => 'password',
'skipEmpty' => true
);
// Validate
if ($user->validates(compact('rules')) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment