protected function getRules()
    {
        $result = [];
        $relationNames = [];
        foreach ($this->relations as $key => $value) {
            $relationNames[] = is_array($value) ? $key : $value;
        }

        foreach ($this->owner->rules() as $key => $rule) {
            $attributes = is_array($rule[0]) ? $rule[0] : [$rule[0]];
            if (!$relations = array_intersect($relationNames, $attributes)) {
                continue;
            }
            $rule[0] = $relations;
            $result[$key] = $rule;
        }
        return $result;
    }