Get the validation rules that apply to the request.

@return array
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'],
        ]);
    }
1031992
public function rules()
    {
        $hash = $this->input('hash');
        $id = (! empty($hash)) ? $this->post->byHash($hash)->id : 0;
        $protected_visibility = $this->visibility->whereName('Protected')->first()->hash;

        return [
            'title'             => 'required|min:2|max:100',
            'slug'              => "required|unique:posts,slug,$id|min:2|max:120",
            'reviewer'          => 'exists:users,hash',
            'post'              => 'required',
            'category'          => 'required|exists:categories,hash',
            'publishdate'       => 'required|date_format: d-m-Y H:i',
            'password'          => "required_if:visibility,$protected_visibility",
        ];
    }
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];
    }
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;
    }
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;
    }
709976
public function rules()
    {
        $rules = $this->filterRules(array_merge([
            [['username', 'password'], 'trim'],
            [['username', 'password'], 'required'],
            ['rememberMe', 'boolean'],
            ['password', 'authenticate'],
        ], $this->rulesAddScenario(parent::rules(), 'reset')));

        return $rules;
    }
1018072
public function validated(): array
    {
        $rules = $this->container->call([$this, 'rules']);

        return $this->only(collect($rules)->keys()->map(function ($rule) {
            return str_contains($rule, '.') ? explode('.', $rule)[0] : $rule;
        })->unique()->toArray());
    }
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;
    }
1321808
public function rules()
    {
        $crude = CrudeInstance::get($this->crudeName);

        if ($crude == null)
            return [];

        if (! $crude instanceof \JanDolata\CrudeCRUD\Engine\Interfaces\WithValidationInterface)
            return [];

        $attr = $crude->getCrudeSetup()->getEditForm();

        return $crude->getValidationRules($attr, $this->all());
    }
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;
    }
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;
    }
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;
	}
47175
public function getAuthKeyRules()
    {
        if (!is_string($this->authKeyAttribute) || empty($this->authKeyAttribute)) {
            return [];
        }
        if (empty($this->authKeyRules)) {
            $this->authKeyRules = [
                [[$this->authKeyAttribute], 'required'],
                [[$this->authKeyAttribute], 'string', 'max' => 40],
            ];
        }
        return $this->authKeyRules;
    }
1334860
public function rules()
    {
        $user = $this->users->findBy('id', \Auth::user()->id);

        return [
            'username' => 'required|max:255|unique:users,username,'.$user->id,
            'email' => 'required|email|max:255|unique:users,email,'.$user->id,
            'password' => 'sometimes|required|min:6|confirmed'
        ];
    }
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,
        ];
    }
915888
protected function getRules()
    {
        if ($this->compiledRules === null) {
            $rules = array();

            foreach ($this->ruleFiles as $file) {
                $rules += require $file;
            }

            $this->compiledRules = $this->compiler->compile($rules);
        }

        return $this->compiledRules;
    }
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();
    }