private function customRules()
    {
        // Get the methods of the calling class.
        $methods = get_class_methods(get_called_class());

        // Custom rule methods begin with "custom".
        $methods = array_filter($methods, function($var) {
            return strpos($var, 'custom') !== false && $var !== 'customRules';
        });

        if (count($methods)) {
            foreach ($methods as $method) {
                $self = $this;

                // Convert camelCase method name to snake_case
                // custom rule name.
                $customRule = snake_case($method);
                $customRule = str_replace('custom_', '', $customRule);

                // Extend the validator using the return value
                // of the custom rule method.
                $this->validator->extend($customRule, function($attribute, $value, $parameters) use ($self, $method) {
                    return $self->$method($attribute, $value, $parameters);
                });
            }
        }
    }
private function customRules()
    {
        // Get the methods of the calling class.
        $methods = get_class_methods(get_called_class());

        // Custom rule methods begin with "custom".
        $methods = array_filter($methods, function($var) {
            return strpos($var, 'custom') !== false && $var !== 'customRules';
        });

        if (count($methods)) {
            foreach ($methods as $method) {
                $self = $this;

                // Convert camelCase method name to snake_case
                // custom rule name.
                $customRule = snake_case($method);
                $customRule = str_replace('custom_', '', $customRule);

                // Extend the validator using the return value
                // of the custom rule method.
                $this->validator->extend($customRule, function($attribute, $value, $parameters) use ($self, $method) {
                    return $self->$method($attribute, $value, $parameters);
                });
            }
        }
    }
private function customRules ( ) { // Get the methods of the calling class. $ methods = get_class_methods ( get_called_class ( ) ) ; // Custom rule methods begin with "custom". $ methods = array_filter ( $ methods , function ( $ var ) { return strpos ( $ var , 'custom' ) !== false && $ var !== 'customRules' ; } ) ; if ( count ( $ methods ) ) { foreach ( $ methods as $ method ) { $ self = $ this ; // Convert camelCase method name to snake_case // custom rule name. $ customRule = snake_case ( $ method ) ; $ customRule = str_replace ( 'custom_' , '' , $ customRule ) ; // Extend the validator using the return value // of the custom rule method. $ this -> validator -> extend ( $ customRule , function ( $ attribute , $ value , $ parameters ) use ( $ self , $ method ) { return $ self -> $ method ( $ attribute , $ value , $ parameters ) ; } ) ; } } }
Applies custom rules.

@return void
Applies custom rules .