Skip to content

Commit

Permalink
additional rules feature
Browse files Browse the repository at this point in the history
  • Loading branch information
AnourValar committed Nov 7, 2019
1 parent 8061086 commit f0e398d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/ModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,14 @@ public function scopeValidate(\Illuminate\Database\Eloquent\Builder $query, $pre
$validator->setAttributeNames($this->getAttributeNames());

$validator->after([$this, 'saveValidation']);

$passes = $validator->passes();

if ($passes && $validator->getRules()) {
$validator = \Validator::make($this->attributes, $validator->getRules());
$validator->setAttributeNames($this->getAttributeNames());

$passes = $validator->passes();
}
}

if (! $passes) {
Expand Down

0 comments on commit f0e398d

Please sign in to comment.