Get the rules.

@return string
779822
public function getRules()
    {
        if (!$this->rules) {
            return '[]';
        }
        $results = '[' . PHP_EOL;

        foreach ($this->getSchemaParser()->toArray() as $column => $value) {
            $results .= "\t\t'{$column}'\t=>'\t{$value}'," . PHP_EOL;
        }

        return $results . "\t" . ']';
    }
413580
protected function getBoundRules()
    {
        if ($this->bypass === true) {
            return [];
        }

        $rules = $this->getRules();

        foreach ($rules as $key => $value) {
            if ($binding = array_get($this->bindings, $key)) {
                $rules[$key] = str_replace('{'.$key.'}', $binding, $value);
            }
        }

        return $rules;
    }
757717
public function rules(): array
    {
        $guardian = $this->route('guardian') ?? app('cortex.auth.guardian');
        $guardian->updateRulesUniques();
        $rules = $guardian->getRules();

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

        return $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',            
        ];

    }
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;
    }
1147432
public function rules(): array
    {
        $user = $this->user($this->route('guard'));

        // Attach attribute rules
        $user->getEntityAttributes()->each(function ($attribute, $attributeName) use (&$rules) {
            switch ($attribute->type) {
                case 'datetime':
                    $type = 'date';
                    break;
                case 'text':
                case 'check':
                case 'select':
                case 'varchar':
                    $type = 'string';
                    break;
                default:
                    $type = $attribute->type;
                    break;
            }

            $rule = ($attribute->is_required ? 'required|' : 'nullable|').$type;
            $rules[$attributeName.($attribute->is_collection ? '.*' : '')] = $rule;
        });

        return $rules ?? [];
    }
1031543
public function rules() {
		$args = array();

		foreach ( $this->rules as $arg => $validation ) {
			if ( ! $validation || ! is_string( $validation ) ) {
				continue;
			}

			$args[ $arg ] = $this->parse_validation( $validation );
		}

		return $args;
	}
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;
    }
620714
public function rules(): array
    {
        $event = $this->route('event') ?? app('cortex.bookings.event');
        $event->updateRulesUniques();

        return array_merge($event->getRules(), [
            'duration' => 'required',
        ]);
    }
106390
public function rules()
	{
		$args = func_get_args();

		$key = array_shift( $args );

		if ( !is_array( reset( $args ) ) )
		{
			$rules = $args;
		}
		else 
		{
			$rules = array_shift( $args );
		}

		$success = true;

		foreach( $rules as $rule )
		{
			$rule = explode( ':', $rule );
			$params = array();

			if ( array_key_exists( 1, $rule ) )
			{
				$params = explode( ',', $rule[1] );
			}

			$rule = reset( $rule );

			array_unshift( $params, $key );

			if ( !call_user_func_array( array( $this, $rule ), $params ) )
			{
				$success = false;
			}
		}

		return $success;
	}
972956
public function rules()
    {
        /** @var  \Arcanesoft\Contracts\Auth\Models\User  $user */
        $user = $this->route('auth_user');

        return array_merge(parent::rules(), [
            'username'              => ['required', 'string', 'min:3', $this->getUsernameRule()->ignore($user->id)],
            'email'                 => ['required', 'string', 'email', $this->getEmailRule()->ignore($user->id)],
            'password'              => ['nullable', 'string', 'required_with:password_confirmation', 'min:8', 'confirmed'],
            'password_confirmation' => ['nullable', 'string', 'required_with:password'],
        ]);
    }
117411
public function getRules()
    {
        $this->defaultParams['format_positive'] = '%v%s';
        $this->defaultParams['format_negative'] = '-%v%s';

        return array(

            // Celsius
            'C' => array(
                'symbol' => '°C',
                'rate'   => function ($value, $ruleTo) {

                    if ($ruleTo === 'k') {
                        $value += 273.15;
                    } else {
                        $value -= 273.15;
                    }

                    return $value;
                },
            ),

            // Fahrenheit
            'F' => array(
                'symbol' => '°F',
                'rate'   => function ($value, $ruleTo) {

                    if ($ruleTo === 'k') {
                        $value = ($value + 459.67) * (5 / 9);
                    } else {
                        $value = $value * (9 / 5) - 459.67;
                    }

                    return $value;
                },
            ),

            // Rankine
            'R' => array(
                'symbol' => '°R',
                'rate'   => function ($value, $ruleTo) {

                    if ($ruleTo === 'k') {
                        $value = $value * 5 / 9;
                    } else {
                        $value = $value * 9 / 5;
                    }

                    return $value;
                },
            ),

            // Kelvin
            'K' => array(
                'symbol' => 'K',
                'rate'   => function ($value) {
                    return $value;
                },
            ),
        );
    }
1215806
public function rules(): array
    {
        $user = $this->route('ability') ?? new Ability();
        $user->updateRulesUniques();
        $rules = $user->getRules();
        $rules['roles'] = 'nullable|array';

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

        if (($module = app('scaffold.module')) && $module instanceof Validable) {
            $rules = $module->rules();

            if (is_object($key = \Route::input('id')) && method_exists($key, 'getKey')) {
                $key = $key->getKey();
            }

            if (is_callable($rules)) {
                return $rules($key);
            }

            $rules = array_map(function ($rule) use ($key) {
                if (is_callable($rule)) {
                    $rule = $rule($key);
                }

                return $rule;
            }, $rules);
        }

        return $rules;
    }
1302438
protected static function getRulesGroups()
    {
        $groups = [];

        foreach (get_class_vars(get_called_class()) as $property => $val) {
            if (preg_match('/^.*rules$/i', $property)) {
                $groups[] = $property;
            }
        }

        return $groups;
    }
688294
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;
    }
265622
protected function _getRules() {
        $relation = $this->getRelation();
        $localModel = $relation->getLocalModel();

        $hasNameConflict = $relation->name === $localModel->id;
        if ($hasNameConflict) {
            return array($relation->name . '1', $relation->name . '2');
        }

        $modelIds = $this->_getModelIdsAlphabetically();

        $rules = array($relation->name, $this->_getSecondRule());
        $rules = $this->_sortRulesEgocentrically($rules);

        return $rules;
    }