Construct the validation rules with values given in the config.

@return \GraphQL\Validator\Rules\ValidationRule[]
9193
protected function getValidationRules(): array
    {
        return [
            QueryComplexity::class => new QueryComplexity(config('lighthouse.security.max_query_complexity', 0)),
            QueryDepth::class => new QueryDepth(config('lighthouse.security.max_query_depth', 0)),
            DisableIntrospection::class => new DisableIntrospection(config('lighthouse.security.disable_introspection', false)),
        ];
    }
285464
public function rules(): array
    {
        $manager = $this->route('manager') ?? app('cortex.auth.manager');
        $manager->updateRulesUniques();
        $rules = $manager->getRules();

        $rules['roles'] = 'nullable|array';
        $rules['tenants'] = 'nullable|array';
        $rules['abilities'] = 'nullable|array';
        $rules['password'] = $manager->exists
            ? 'confirmed|min:'.config('cortex.auth.password_min_chars')
            : 'required|confirmed|min:'.config('cortex.auth.password_min_chars');

        return $rules;
    }
1058030
public function getValidationRules()
    {
        $rules = $this->getOption('rules', []);
        $name = $this->getNameKey();
        $messages = $this->getOption('error_messages', []);
        $formName = $this->formHelper->transformToDotSyntax($this->parent->getName());

        if ($messages && $formName) {
            $newMessages = [];
            foreach ($messages as $messageKey => $message) {
                $messageKey = sprintf('%s.%s', $formName, $messageKey);
                $newMessages[$messageKey] = $message;
            }
            $messages = $newMessages;
        }

        if (!$rules) {
            return (new Rules([]))->setFieldName($this->getNameKey());
        }

        if (is_array($rules)) {
            $rules = array_map(function ($rule) use ($name) {
                if ($rule instanceof \Closure) {
                    return $rule($name);
                }

                return $rule;
            }, $rules);
        }

        return (new Rules(
            [$name => $rules],
            [$name => $this->getOption('label')],
            $messages
        ))->setFieldName($this->getNameKey());
    }
1224614
public function rules() {
        return [
            'processRequired' => [['code', 'name', 'flag', 'is_active'], 'required', 'on' => ['create', 'update']],
            'searchSafe' => [['code', 'name', 'is_active'], 'safe', 'on' => ['search']],
            'codeUnique' => ['code', 'unique',
                'targetClass' => Language::className(),
                'message' => Yii::t('multilang', 'Code must be unique'),
                'when' => function($model, $attribute) {
                    return $model->{$attribute} != $model->getOldAttribute($attribute);
                }, 'on' => ['create', 'update']],
        ];
    }
635026
public function rules()
    {
        $rules = parent::rules();
        $rules = array_merge($rules, [
            ['fieldTwig', 'string'],
            ['fieldTwig', 'default', 'value' => ''],
            ['columnType', 'string'],
            ['columnType', 'default', 'value' => ''],
            ['decimals', 'number'],
            ['decimals', 'default', 'value' => 0],
            ['textareaRows', 'number'],
            ['textareaRows', 'default', 'value' => 5],
            ['parseBeforeSave', 'boolean'],
            ['parseBeforeSave', 'default', 'value' => false],
            ['parseOnMove', 'boolean'],
            ['parseOnMove', 'default', 'value' => false],
            ['displayType', 'string'],
            ['displayType', 'default', 'value' => 'hidden'],
            ['allowSelect', 'boolean'],
            ['allowSelect', 'default', 'value' => false],
        ]);

        return $rules;
    }
414227
protected function buildValidationRules()
    {
        $rules = new RuleList();

        $options = $this->getOptions();
        $options[self::OPTION_ENTITY_TYPES] = $this->getEmbeddedEntityTypeMap();

        $rules->push(
            new EmbeddedEntityListRule('valid-embedded-entity-list-data', $options)
        );

        return $rules;
    }
113878
public function rules(): array
    {
        $user = $this->user($this->route('guard'));
        $user->updateRulesUniques();

        return $user->getRules();
    }
525836
public function getUserRelationRules()
    {
        $rules = [];
        if ($this->relationType == static::$relationMutual) {
            $rules = [
                [[$this->mutualTypeAttribute], 'in', 'range' => array_keys(static::$mutualTypes)],
                [[$this->mutualTypeAttribute], 'default', 'value' => static::$mutualTypeNormal],
            ];
        }
        return array_merge($rules, $this->getRemarkRules(),
            $this->getFavoriteRules(),
            $this->getGroupsRules(),
        $this->getOtherGuidRules());
    }
1289119
public function getValidationRules()
    {
        $rules = parent::getValidationRules();

        foreach ($rules as &$rule) {
            if ($rule !== '_unique') {
                continue;
            }

            $model = $this->resolvePath();
            $table = $model->getTable();

            $rule = 'unique:'.$table.','.$this->getModelAttributeKey();
            if ($model->exists) {
                $rule .= ','.$model->getKey();
            }
        }
        unset($rule);

        return [$this->getPath() => $rules];
    }
223982
public function rules(): array
    {
        $admin = $this->route('admin') ?? app('cortex.auth.admin');
        $admin->updateRulesUniques();
        $rules = $admin->getRules();

        $rules['roles'] = 'nullable|array';
        $rules['abilities'] = 'nullable|array';
        $rules['password'] = $admin->exists
            ? 'confirmed|min:'.config('cortex.auth.password_min_chars')
            : 'required|confirmed|min:'.config('cortex.auth.password_min_chars');

        return $this->isMethod('POST') ? $rules : [];
    }
155135
public function rules()
    {
        return array_merge(
            parent::rules(),
            $this->getPasswordHashRules(),
            $this->getPasswordResetTokenRules(),
            $this->getSourceRules(),
            $this->getStatusRules(),
            $this->getAuthKeyRules(),
            $this->getAccessTokenRules()
        );
    }
1092935
public function rules()
    {
        $this->buildForm();

        $this->extendForm();
        
        $rules = [];

        foreach ($this->fields() as $field) {
            if (!is_null($field->getRules())) {
                $rules[$field->getName()] = $field->getRules();
            }
        }

        return $rules;
    }
144876
public function validationRules(array $rules = array())
    {
        if (empty($rules)) {
            return $this->validationRules;
        }

        $this->validationRules = $rules;

        return $this;
    }
1255122
public function getRules()
    {
        $rules = [
            static::FIRST_NAME => "required|max:100",
            static::LAST_NAME => "required|max:100",
            static::EMAIL => "required|max:100|email|unique:users,email,{$this->id},id",
        ];
        if (!$this->id) {
            $rules[static::PWD_FIELD] = 'required|min:' . config('app.model.user.password.min', 6)
                . '|max:' . config('app.model.user.password.max', 20);
        }
        return $rules;
    }
539018
public function getRule()
    {
        $rules = [];
        if ($this->isRequired()) {
            $rules[] = 'required';
        }
        if ($this->getValidations()) {
            $rules[] = $this->getValidations();
        }

        $rules = join('|', $rules);
        return $rules;
    }
65412
public function rules(): array
    {
        $input = array_keys($this->request->all());

        return Parameter::whereIn('id', $input)
            ->get()
            ->mapWithKeys(function ($item) {
                return [$item['id'] => $item->rules];
            })->all();
    }
1083596
public function rules()
    {
        $module = UsersModule::module();
        $rules = [
            [
                ['phone'],
                'safe',
            ],
            [
                [
                    'password',
                ],
                'safe',
                'on' => self::SCENARIO_DEFAULT,
            ],
            [
                [
                    'password',
                ],
                'required',
                'on' => self::SCENARIO_PASSWORD_RESET,
            ],
            [
                'username',
                'unique',
            ],
            [
                'email',
                'unique',
            ],
            'standardEmailRules' => [
                [
                    'email',
                ],
                'email',
                'checkDNS' => $module->authorizationScenario()->emailCheckDNS,
                'enableIDN' => $module->authorizationScenario()->emailEnableIDN,
                'skipOnEmpty' => true,
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ],
            'trimEmail' => [
                [
                    'email',
                ],
                'filter',
                'filter' => 'trim',
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ],
            [
                [
                    'username_is_temporary',
                    'password_is_temporary',
                    'is_active',
                ],
                'filter',
                'filter' => 'boolval',
            ]
        ];
        $property_rules = $this->propertiesRules();
        if (!empty($property_rules)) {
            $rules = array_merge($rules, $property_rules);
        }
        if (count(UsersModule::module()->requiredUserAttributes) > 0) {
            $rules['requiredAttributes'] = [
                UsersModule::module()->requiredUserAttributes,
                'required',
                'on' => self::SCENARIO_PROFILE_UPDATE,
            ];
        }


        return $rules;
    }