Skip to content
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.

Commit

Permalink
Including a validateUniques method, just like we currently have updat…
Browse files Browse the repository at this point in the history
…eUniques. closes #140
  • Loading branch information
igorsantos07 committed Dec 26, 2013
1 parent 1103d02 commit 8ac1128
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/LaravelBook/Ardent/Ardent.php
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,19 @@ public function updateUniques(array $rules = array(),
return $this->save($rules, $customMessages, $options, $beforeSave, $afterSave);
}

/**
* Validates a model with unique rules properly treated.
*
* @param array $rules Validation rules
* @param array $customMessages Custom error messages
* @return bool
* @see Ardent::validate()
*/
public function validateUniques(array $rules = array(), array $customMessages = array()) {
$rules = $this->buildUniqueExclusionRules($rules);
return $this->validate($rules, $customMessages);
}

/**
* Find a model by its primary key.
* If {@link $throwOnFind} is set, will use {@link findOrFail} internally.
Expand Down

0 comments on commit 8ac1128

Please sign in to comment.