diff --git a/src/Support/Traits/ValidationTrait.php b/src/Support/Traits/ValidationTrait.php index 508c3f1..7d2ead1 100644 --- a/src/Support/Traits/ValidationTrait.php +++ b/src/Support/Traits/ValidationTrait.php @@ -31,8 +31,7 @@ trait ValidationTrait */ public function onValidationScenario($scenario, array $parameters = []) { - $on = 'on'.ucfirst($scenario); - $extend = 'extend'.ucfirst($scenario); + list($on, $extend) = $this->getValidationSchemasName($scenario); $this->validationScenarios = [ 'on' => method_exists($this, $on) ? $on : null, @@ -182,4 +181,18 @@ public function getValidationRules() { return []; } + + /** + * Get validation schemas name. + * + * @param string $scenario + * @return array + */ + protected function getValidationSchemasName($scenario) + { + $on = 'on'.ucfirst($scenario); + $extend = 'extend'.ucfirst($scenario); + + return [$on, $extend]; + } }