public function getRules(array $fields = [])
    {
        $default_rules = $this->model->getRules();
        
        if (count($fields) < 1) {
            return $default_rules;
        }
        
        foreach ($fields as $field => $rule) {
            if (is_int($field)) {
                $rules[$rule] = $default_rules[$rule];
                continue;
            }
            
            if (! key_exists($field, $default_rules)) {
                continue;
            }
            
            $default_rules[$field] .= '|' . $rule;
        }
        
        $rules = [];
        $transformation = $this->model->getTransformation();
        foreach ($transformation as $original => $transformed) {
            $rules[$transformed] = $default_rules[$original];
        }
        
        foreach ($fields as $field => $rule) {
            if (! key_exists($field, $rules)) {
                continue;
            }
            
            $rules[$field] .= '|' . $rule;
        }
        
        return $rules;
    }
public function getRules(array $fields = [])
    {
        $default_rules = $this->model->getRules();
        
        if (count($fields) < 1) {
            return $default_rules;
        }
        
        foreach ($fields as $field => $rule) {
            if (is_int($field)) {
                $rules[$rule] = $default_rules[$rule];
                continue;
            }
            
            if (! key_exists($field, $default_rules)) {
                continue;
            }
            
            $default_rules[$field] .= '|' . $rule;
        }
        
        $rules = [];
        $transformation = $this->model->getTransformation();
        foreach ($transformation as $original => $transformed) {
            $rules[$transformed] = $default_rules[$original];
        }
        
        foreach ($fields as $field => $rule) {
            if (! key_exists($field, $rules)) {
                continue;
            }
            
            $rules[$field] .= '|' . $rule;
        }
        
        return $rules;
    }
public function getRules ( array $ fields = [ ] ) { $ default_rules = $ this -> model -> getRules ( ) ; if ( count ( $ fields ) < 1 ) { return $ default_rules ; } foreach ( $ fields as $ field => $ rule ) { if ( is_int ( $ field ) ) { $ rules [ $ rule ] = $ default_rules [ $ rule ] ; continue ; } if ( ! key_exists ( $ field , $ default_rules ) ) { continue ; } $ default_rules [ $ field ] .= '|' . $ rule ; } $ rules = [ ] ; $ transformation = $ this -> model -> getTransformation ( ) ; foreach ( $ transformation as $ original => $ transformed ) { $ rules [ $ transformed ] = $ default_rules [ $ original ] ; } foreach ( $ fields as $ field => $ rule ) { if ( ! key_exists ( $ field , $ rules ) ) { continue ; } $ rules [ $ field ] .= '|' . $ rule ; } return $ rules ; }
Rules of Entity

@param array $fields
@return array
Rules of Entity