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

Commit 8ac1128

Browse files
committed
Including a validateUniques method, just like we currently have updateUniques. closes #140
1 parent 1103d02 commit 8ac1128

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/LaravelBook/Ardent/Ardent.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,19 @@ public function updateUniques(array $rules = array(),
828828
return $this->save($rules, $customMessages, $options, $beforeSave, $afterSave);
829829
}
830830

831+
/**
832+
* Validates a model with unique rules properly treated.
833+
*
834+
* @param array $rules Validation rules
835+
* @param array $customMessages Custom error messages
836+
* @return bool
837+
* @see Ardent::validate()
838+
*/
839+
public function validateUniques(array $rules = array(), array $customMessages = array()) {
840+
$rules = $this->buildUniqueExclusionRules($rules);
841+
return $this->validate($rules, $customMessages);
842+
}
843+
831844
/**
832845
* Find a model by its primary key.
833846
* If {@link $throwOnFind} is set, will use {@link findOrFail} internally.

0 commit comments

Comments
 (0)