Get rules associated with enable login attribute.
If enable login feature by this additional account, it will return the rules
with true by default.
@return array rules.
199684
public function getEnableLoginAttributeRules()
    {
        return $this->seperateLoginAttribute && is_string($this->seperateLoginAttribute) && !empty($this->seperateLoginAttribute) ? [
            [[$this->seperateLoginAttribute], 'boolean'],
            [[$this->seperateLoginAttribute], 'default', 'value' => true],
            ] : [];
    }
1150925
public function getTaxRules()
    {
        $rules = [];
        /* @var \Magento\Tax\Model\Calculation\Rule $rule */
        foreach ($this->taxRules as $rule) {
            $_rule = [
                'id'                   => $rule->getId(),
                'name'                 => $rule->getCode(),
                'priority'             => $rule->getPriority(),
                'product_tax_classes'  => [],
                'customer_tax_classes' => [],
                'tax_rates'            => [],
            ];

            foreach (array_unique($rule->getProductTaxClasses()) as $taxClass) {
                $_rule['product_tax_classes'][] = [
                    'id'  => $taxClass,
                    'key' => $taxClass
                ];
            }

            foreach (array_unique($rule->getCustomerTaxClasses()) as $taxClass) {
                $_rule['customer_tax_classes'][] = [
                    'id'  => $taxClass,
                    'key' => $taxClass
                ];
            }

            foreach (array_unique($rule->getRates()) as $taxRates) {
                $_rule['tax_rates'][] = [
                    'id'  => $taxRates,
                    'key' => $taxRates
                ];
            }

            $rules[] = $_rule;
        }

        return $rules;
    }
631445
public function rules()
    {

        $name = $this->route()->getName();
        $tbl = ( str_contains($name, 'role') ) ? 'roles' : 'permissions';

       return [
            'name' => 'required|unique:'.$tbl.'|max:255|min:4',
            'slug' => 'required|unique:'.$tbl.'|max:255|min:4',
        ];

    }
127112
public function rules() : array
    {
        $referral = mb_strtolower($this->request->get('referral') ?? 'profile');

        $resolver = 'rulesFor' . ucfirst($referral);

        return $this->$resolver();
    }
117058
protected function getRules()
	{
		if ( ! $this->hasScope())
		{
			return $this->replaceBindings($this->rules);
		}

		// Set default rules
		$resultingRules = isset($this->rules[$this->getDefaultScope()]) ? $this->rules[$this->getDefaultScope()] : [];

		foreach ($this->scopes as $scope)
		{
			if ( ! isset($this->rules[$scope])) continue;

			$resultingRules = array_merge($resultingRules, $this->rules[$scope]);
		}

		return $this->replaceBindings($resultingRules);
	}
688670
public function getDescriptionRules()
    {
        $rules = [];
        if (is_string($this->descriptionAttribute) && !empty($this->descriptionAttribute)) {
            $rules[] = [
                [$this->descriptionAttribute],
                'string'
            ];
            $rules[] = [
                [$this->descriptionAttribute],
                'default',
                'value' => $this->initDescription,
            ];
        }
        return $rules;
    }
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']],
        ];
    }
785134
private function getBelongTo(): array
    {
        $result = [];

        if (! isset($this->capabilities['action'][Utils::getTypeBelongs()])) {
            return $result;
        }

        $table = TableRegistry::getTableLocator()->get('RolesCapabilities.Capabilities');
        Assert::isInstanceOf($table, CapabilitiesTable::class);

        $groups = $table->getUserGroups($this->user['id']);
        // check user capabilities against action's belongs capabilities
        foreach ($this->capabilities['action'][Utils::getTypeBelongs()] as $capability) {
            if (in_array($capability->getName(), $this->capabilities['user'])) {
                // if user has owner capability for current action add appropriate conditions to where clause
                $result[$this->table->aliasField($capability->getField()) . ' IN'] = array_keys($groups);
            }
        }

        return $result;
    }
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 : [];
    }
399332
public function rules()
    {
        $rules = [];
        foreach ($this->assocConfig(true) as $key => $data) {
            if (empty($data['rules'])) {
                continue;
            }
            $rules[str_replace('.', '|', $key)] = $data['rules'];
        }

        return $rules;
    }
564073
public function getRules(): RuleSet
    {
        $rules = $this->client->get($this->uri->withPath('.settings/rules'));

        return RuleSet::fromArray($rules);
    }
502872
public function rules()
    {

        $id = ( $this->route('permission') ) ?: $this->route('role');

        $tbl = str_plural( $this->route()->parameterNames()[0] );

        return [
            'slug' => 'required|unique:'.$tbl.',slug,'.$id.'|max:255|min:4',
            'name' => 'required|unique:'.$tbl.',name,'.$id.'|max:255|min:4',            
        ];

    }
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;
    }
73691
public function rules(): array
    {
        $member = $this->route('member') ?? app('cortex.auth.member');
        $member->updateRulesUniques();
        $rules = $member->getRules();

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

        return $rules;
    }
665575
private function getParentPermissions() : array
    {
        $result = [];
        foreach ($this->table->associations() as $association) {
            if (! $this->isSupportedJoinAssociation($association)) {
                continue;
            }

            if (! $this->isParentModuleAssociation($association)) {
                continue;
            }

            $foreignKey = $association->getForeignKey();
            Assert::string($foreignKey);

            $field = sprintf('%s IN', $foreignKey);
            $result[$field] = $this->getPermissionsByModel($this->getModelByAssociation($association));
        }

        return $result;
    }
907432
public function rules()
    {
        $rules = [];

        $multiLangFlag = Session::get('multi_language_enabled');
        $defaultLang = Session::get('default_language');
        $requestLanguageId = $this->request->get('language_id', $defaultLang->id);

        if ($requestLanguageId === $defaultLang) {
            $rules['name'] = 'required|max:255';
            $rules['sort_order'] = 'required';
            $rules['is_visible_frontend'] = 'required';
            $rules['use_for_all_products'] = 'required';
            $rules['data_type'] = 'required';
            $rules['field_type'] = 'required';
            if ($this->getMethod() == 'POST') {
                $rules['identifier'] = 'required|max:255|alpha_dash|unique:properties';
            }
            if ($this->getMethod() == 'PUT') {
                $rules['identifier'] = 'required|max:255|alpha_dash';
            }
        } else {
            $rules['name'] = 'required|max:255';
            $rules['identifier'] = 'required|max:255|alpha_dash';
        }

        return $rules;
    }
413495
public function commonApplicationAttributes()
    {
        return [
            'modules' => [
                'users' => [
                    'emailConfirmationNeeded' => (bool)$this->emailConfirmationNeeded,
                    'allowLoginInactiveAccounts' => (bool)$this->allowLoginInactiveAccounts,
                    'enableSocialNetworks' => (bool)$this->enableSocialNetworks,
                    'logLastLoginTime' => (bool)$this->logLastLoginTime,
                    'logLastLoginData' => (bool)$this->logLastLoginData,
                    'passwordResetTokenExpire' => (int)$this->passwordResetTokenExpire,
                    'loginDuration' => (int)$this->loginDuration,
                    'generatedPasswordLength' => (int)$this->generatedPasswordLength,
                ]
            ],
        ];
    }