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

Commit

Permalink
Enabling usage of unique rules out of the model as well
Browse files Browse the repository at this point in the history
See buildUniqueExclusionRules() doc for details
  • Loading branch information
igorsantos07 committed Dec 7, 2015
1 parent 73fba06 commit 028044d
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Ardent/Ardent.php
Original file line number Diff line number Diff line change
Expand Up @@ -800,18 +800,16 @@ protected function hashPasswordAttributes(array $attributes = array(), array $pa
}

/**
* When given an ID and a Laravel validation rules array, this function
* appends the ID to the 'unique' rules given. The resulting array can
* then be fed to a Ardent save so that unchanged values
* don't flag a validation issue. Rules can be in either strings
* with pipes or arrays, but the returned rules are in arrays.
*
* @param int $id
* Appends the model ID to the 'unique' rules given. The resulting array can
* then be fed to a Ardent save so that unchanged values don't flag a validation
* issue. It can also be used with {@link Illuminate\Foundation\Http\FormRequest}
* to painlessly validate model requests.
* Rules can be in either strings with pipes or arrays, but the returned rules
* are in arrays.
* @param array $rules
*
* @return array Rules with exclusions applied
*/
protected function buildUniqueExclusionRules(array $rules = array()) {
public function buildUniqueExclusionRules(array $rules = array()) {

if (!count($rules))
$rules = static::$rules;
Expand Down

0 comments on commit 028044d

Please sign in to comment.