Set foreign key update behaviour.

@param string $rule Possible values: NO ACTION, CASCADE, etc (driver specific).
@return self
978518
public function onUpdate(string $rule = self::NO_ACTION): AbstractForeignKey
    {
        $this->updateRule = strtoupper($rule);

        return $this;
    }
986961
protected function setRules( array $rules )
	{
		foreach( $rules as $key => $rule ) {
			$rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
		}

		$this->rules = $rules;

		return $this;
	}
453721
private function setAttributeRules(array $rules): self
    {
        assert($this->debugCheckIndexesExist($rules));

        $this->attributeRules = $rules;

        return $this;
    }
838274
public function error($rule=null) {
		if($rule === null)
			return $this->self;
		elseif(isset($this->rules[$rule]))
			return $this->rules[$rule];
		elseif($attribute = $this->attribute($rule))
			return $attribute->error();
	}
1102741
protected function addRule(AbstractRule $rule, $category = self::CATEGORY_NONE) {
        $rule->setRuleSet($this);

        $this->rules[] = $rule;
        $this->categories[$category][] = $rule;

        return $this;
    }
571204
public function allowIp($rule) {
        $this->check_role = 'denyIp';
        $ip = request()->ip();
        if (!is_array($rule)) {
            $rule = explode(',', $rule);
        }
        $result = in_array($ip, $rule);
        $this->checkResult($result);
        return $this;
    }
513981
public function addRules(array $rules)
    {
        foreach ($rules as $character => $replacement) {
            $this->addRule($character, $replacement);
        }

        return $this;
    }
498199
public function setRule ($identifier, callable $rule, $singleton = false)
		{
			if (! is_bool($singleton)) {
				throw new DependencyException('The singleton parameter must be boolean.');
			}

			if ($singleton) {
				$this->setSingletonRule($identifier, $rule);
			} else {
				$this->rules[$identifier] = new CallbackRule($this, $rule);
			}

			return $this;
		}
190300
private function setToOneIndexes(array $rules): self
    {
        assert($this->debugCheckIndexesExist($rules));

        $this->toOneRules = $rules;

        return $this;
    }
441012
public function merge(Set $rules): self
    {
        $this->rules = array_merge($this->rules, $rules->rules);
        return $this;
    }
768431
public function storeRuleSuccess(RuleContract $rule)
    {
        $url     = handles('antares::ban_management/rules/datatable');
        $message = trans('antares/ban_management::response.rules.create.success');

        return $this->redirectWithMessage($url, $message);
    }
598547
public function addRule(Rule $rule)
    {
        $classname = $rule->getClass();
        if ($this->hasRule($classname) === true) {
            throw new Exception(
                "failed to add rule; the field {$this->name} already has an ".
                "instance of '$classname'"
            );
        }
        else if ($classname === Rule::REQUIRED) {
            $this->rules = [$classname => $rule] + $this->rules;
        }
        else {
            $this->rules[$classname] = $rule;
        }
        return $this;
    }
1370012
public function excludeByRule(Closure $rule)
    {
        $result = $this->target;

        foreach ($result as $key => $value) {
            if ($rule($key, $value)) {
                unset($result[$key]);
            }
        }

        return $result;
    }
431342
public function pattern($name, $rule = '')
    {
        if (is_array($name)) {
            $this->pattern = array_merge($this->pattern, $name);
        } else {
            $this->pattern[$name] = $rule;
        }

        return $this;
    }
620768
public function remove( $field, $rule = true )
	{
		if( is_array( $field ) ){
			foreach( $field as $key => $rule ){
				if( is_int( $key ) ){
					$this->remove( $rule );
				} else{
					$this->remove( $key, $rule );
				}
			}
		} else{
			if( is_string( $rule ) ){
				$rule = explode( '|', $rule );
			}
			$this->remove[$field] = $rule;
		}
		return $this;
	}
614763
public function withRules(array $rules): self
    {
        $new = clone $this;
        /* Clear the stack */
        unset($new->rules);
        $new->rules = new \SplStack;
        /* Add the rules */
        foreach ($rules as $callable) {
            $new = $new->addRule($callable);
        }
        return $new;
    }
91791
public function updateRules(&$rules)
    {
        $originalRules = $rules;
        $fluentRules = $this->getExplicitRoutes($rules);

        // Insert Fluent Rules before the default '$URLSegment//$Action/$ID/$OtherID'
        $rules = $this->insertRuleBefore($rules, '$URLSegment//$Action/$ID/$OtherID', $fluentRules);

        $request = Injector::inst()->get(HTTPRequest::class);
        if (!$request) {
            throw new Exception('No request found');
        }

        // Ensure InitStateMddleware is called here to set the correct defaultLocale
        Injector::inst()->create(InitStateMiddleware::class)->process($request, function () {
        });

        $defaultLocale = Locale::getDefault(true);
        if (!$defaultLocale) {
            return;
        }

        // If we do not wish to detect the locale automatically, fix the home page route
        // to the default locale for this domain.
        if (!static::config()->get('detect_locale')) {
            // Respect existing home controller
            $rules[''] = [
                'Controller' => $this->getRuleController($originalRules[''], $defaultLocale),
                static::config()->get('query_param') => $defaultLocale->Locale,
            ];
        }

        // If default locale doesn't have prefix, replace default route with
        // the default locale for this domain
        if (static::config()->get('disable_default_prefix')) {
            $rules['$URLSegment//$Action/$ID/$OtherID'] = [
                'Controller' => $this->getRuleController($originalRules['$URLSegment//$Action/$ID/$OtherID'], $defaultLocale),
                static::config()->get('query_param') => $defaultLocale->Locale
            ];
        }
    }