Get the validation rules that apply to the request.

@return array
347069
public function rules()
    {
        $except = is_integer($id = optional($this->article)->id)  ? ",$id,id" : '';

        return [
            // Main content.
            'title' => [
                'bail',
                'required',
                'string',
                'max:255',
                'unique:articles,title'.$except,
            ],
            'slug' => [
                'bail',
                'nullable',
                'string',
                'max:255',
                'unique:articles,slug'.$except,
                'required_with:title',
            ],
            'teaser' => [
                'nullable',
                'string',
                'max:255',
            ],
            'content' => [
                'nullable',
                'string',
            ],
            'description' => [
                'nullable',
                'string',
                'max:255',
            ],
            'keywords' => [
                'nullable',
                'string',
                'max:255',
            ],

            // Flags ?
            'state' => [
                'required',
                'string',
                'in:draft,unpublished,published',
            ],
            'on_mainpage' => [
                'nullable',
                'boolean',
            ],
            'is_favorite' => [
                'nullable',
                'boolean',
            ],
            'is_pinned' => [
                'nullable',
                'boolean',
            ],
            'is_catpinned' => [
                'nullable',
                'boolean',
            ],

            // DateTime.
            'currdate' => [
                'nullable',
                'boolean',
            ],
            'customdate' => [
                'nullable',
                'boolean',
            ],
            'created_at' => [
                'nullable',
                'date_format:"Y-m-d H:i:s"',
                'required_with:customdate',
            ],

            // Extension.
            'allow_com' => [
                'required',
                'numeric',
                'in:0,1,2',
            ],
            'views' => [
                'nullable',
                'integer',
            ],
            'votes' => [
                'nullable',
                'integer',
            ],
            'rating' => [
                'nullable',
                'integer',
            ],

            // Relations types.
            'image_id' => [
                'nullable',
                'integer',
                'exists:files,id',
            ],
            'categories' => [
                'nullable',
                'array',
            ],
            'categories.*' => [
                'integer',
                'exists:categories,id',
            ],
            'files' => [
                'nullable',
                'array',
            ],
            'files.*' => [
                'integer',
                'exists:files,id',
            ],
            'images' => [
                'nullable',
                'array',
            ],
            'images.*' => [
                'integer',
                'exists:files,id',
            ],
            'tags' => [
                'nullable',
                'array',
            ],
            'tags.*' => [
                'string',
                'max:255',
                'regex:/^[\w-]+$/u',
            ],
        ];
    }
1215806
public function rules(): array
    {
        $user = $this->route('ability') ?? new Ability();
        $user->updateRulesUniques();
        $rules = $user->getRules();
        $rules['roles'] = 'nullable|array';

        return $rules;
    }
268630
public function getRules()
    {
        if (!$this->rules) {
            return 'return [];';
        }

        $parser = new SchemaParser($this->rules);

        $results = 'return ['.PHP_EOL;

        foreach ($parser->toArray() as $field => $rules) {
            $results .= $this->createRules($field, $rules);
        }

        $results .= "\t\t];";

        return $results;
    }
266935
public function filterableValidationRules() : array
    {
    	return $this->filterable()->filter(function ($item) {
                return trim($item->validation_rules) != '' && ! is_null($item->validation_rules);
            })->mapWithKeys(function ($item) {
                return ['features.' . $item->name => $item->validation_rules];
            })->all();
    }
835268
public function rules()
    {

        $allowed_registration = implode(',', Seat::$options['registration']);
        $allowed_cleanup = implode(',', Seat::$options['cleanup_data']);
        $allowed_tracking = implode(',', Seat::$options['allow_tracking']);

        return [
            'registration'   => 'required|in:' . $allowed_registration,
            'cleanup_data'   => 'required|in:' . $allowed_cleanup,
            'admin_contact'  => 'required|email',
            'allow_tracking' => 'required|in:' . $allowed_tracking,
        ];
    }
761540
public function rules()
    {
        return ArrayHelper::merge(parent::rules(), [
            // nickname rules
            'nicknameRequired' => ['nickname', 'required', 'on' => [self::SCENARIO_EMAIL_REGISTER, self::SCENARIO_CONNECT]],
            // email rules
            'emailRequired' => ['email', 'required', 'on' => [self::SCENARIO_EMAIL_REGISTER]],
            //mobile rules
            'mobileRequired' => ['mobile', 'required', 'on' => [self::SCENARIO_MOBILE_REGISTER]],
            // password rules
            'passwordRequired' => ['password', 'required', 'on' => [self::SCENARIO_EMAIL_REGISTER, self::SCENARIO_MOBILE_REGISTER]],
            // tags rules
            'tags' => ['tagValues', 'safe'],

            'transfer_balance' => ['transfer_balance', 'number'],
            'balance' => ['balance', 'number'],
        ]);
    }
578694
public function rules()
    {
        $validationRule = [];
        $validationRule['name'] = 'required|max:255';

        if (null !== $this->request->get('dropdown-options')) {
            foreach ($this->request->get('dropdown-options') as $key => $val) {
                if ($key == '__RANDOM_STRING__') {
                    continue;
                }
                $validationRule['dropdown-options.' . $key . '.display_text'] = 'required';
            }
        }

        if ($this->getMethod() == 'POST') {
            $validationRule['identifier'] = 'required|max:255|alpha_dash|unique:attributes';
        }
        if ($this->getMethod() == 'PUT') {
            $validationRule['identifier'] = 'required|max:255|alpha_dash';
        }

        return $validationRule;
    }
1024650
protected function getBindedRules(): array
    {
        $rules = $this->getValidationRules();

        if (! empty($this->validationBindings)) {
            foreach ($rules as $key => $value) {
                $rules[$key] = Str::replace($value, $this->validationBindings);
            }
        }

        return $rules;
    }
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;
    }
1107334
public function rules()
    {
        $redirect = $this->route('seo_redirect');

        return [
            'old_url' => ['required', 'string', $this->getOldUrlRule()->ignore($redirect->id)],
            'new_url' => ['required', 'string'],
            'status'  => $this->getStatusRule(),
        ];
    }
138103
public function rules(): array
    {
        $managerRules = app('cortex.auth.manager')->getRules();
        $managerRules['password'] = 'required|confirmed|min:'.config('cortex.auth.password_min_chars');
        $managerRules = array_combine(
            array_map(function ($key) {
                return 'manager.'.$key;
            }, array_keys($managerRules)), $managerRules
        );

        $tenantRules = app('rinvex.tenants.tenant')->getRules();
        $tenantRules = array_combine(
            array_map(function ($key) {
                return 'tenant.'.$key;
            }, array_keys($tenantRules)), $tenantRules
        );

        return array_merge($managerRules, $tenantRules);
    }
315442
public function getModelStaticValidationRules()
    {
        $model = $this->getDataModel();

        return isset($model::$rules) && is_array($model::$rules) ? $model::$rules : false;
    }
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',
        ];

    }
739434
public function rules()
    {
        return [
            'title' => 'required|max:255|' . Rule::unique('laramanager_navigation_sections', 'title')->ignore($this->segment(3)),
            'icon' => 'required|max:255|' . Rule::unique('laramanager_navigation_sections', 'icon')->ignore($this->segment(3)),
            'ordinal' => 'required|integer|max:100'
        ];
    }
255265
protected function _getValidationRules() {
		$language = (string)Configure::read('Config.language');
		$cachePath = 'validation_rules_' . $language;
		$cached = Cache::read($cachePath, CAKE_LDAP_CACHE_KEY_LDAP_SYNC_DB);
		if ($cached !== false) {
			return $cached;
		}

		$result = $this->_getLocalFieldsValidationRules();
		$result += $this->_getLdapFieldsValidationRules();
		Cache::write($cachePath, $result, CAKE_LDAP_CACHE_KEY_LDAP_SYNC_DB);

		return $result;
	}
72235
public function getRules()
    {
        $this->defaultParams['num_decimals']    = 2;
        $this->defaultParams['num_decimals']    = 2;
        $this->defaultParams['round_type']      = Formatter::ROUND_CLASSIC;
        $this->defaultParams['decimal_sep']     = '.';
        $this->defaultParams['thousands_sep']   = ' ';
        $this->defaultParams['format_positive'] = '%v %s';
        $this->defaultParams['format_negative'] = '-%v %s';

        return array(
            'eur' => array(
                'symbol' => '€',
                'rate'   => 1,
            ),

            'usd' => array(
                'symbol'          => '$',
                'format_positive' => '%s%v',
                'format_negative' => '-%s%v',
                'rate'            => 0.5,
            ),

            'rub' => array(
                'symbol'      => 'руб.',
                'decimal_sep' => ',',
                'rate'        => 0.02,
            ),

            'uah' => array(
                'symbol'      => 'грн.',
                'decimal_sep' => ',',
                'rate'        => 0.04,
            ),

            'byr' => array(
                'symbol'       => 'Br',
                'round_type'   => Formatter::ROUND_CEIL,
                'round_value'  => '-2',
                'num_decimals' => '0',
                'rate'         => 0.00005,
            ),

            '%'   => array(
                'symbol'          => '%',
                'format_positive' => '%v%s',
                'format_negative' => '-%v%s',
            ),
        );
    }
1304939
public function rules(): array
    {
        $service = $this->route('service') ?? app('cortex.bookings.service');
        $service->updateRulesUniques();
        $rules = $service->getRules();

        $rules['availabilities.*.range'] = ['sometimes', 'required', 'string'];
        $rules['availabilities.*.from'] = ['sometimes', 'required', 'string'];
        $rules['availabilities.*.to'] = ['sometimes', 'required', 'string'];
        $rules['availabilities.*.is_bookable'] = ['sometimes', 'boolean'];
        $rules['availabilities.*.priority'] = ['sometimes', 'nullable', 'integer'];

        $rules['rates.*.range'] = ['sometimes', 'required', 'string'];
        $rules['rates.*.from'] = ['sometimes', 'required', 'string'];
        $rules['rates.*.to'] = ['sometimes', 'required', 'string'];
        $rules['rates.*.base_cost'] = ['sometimes', 'nullable', 'numeric'];
        $rules['rates.*.unit_cost'] = ['sometimes', 'required', 'numeric'];

        return $rules;
    }