Get the validation rules that apply to the request.

@return array
352110
public function rules()
    {
        $segment = $this->segment(3);
        $id = isset($segment) ? $this->category->byHash($this->segment(3))->id : 0;

        return [
            'name'		=> "required|unique:categories,name,$id|min:3|max:45",
        ];
    }
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 ?? [];
    }
218108
public function rules()
    {
        if ($this->request->get('product_id', null) !== null) {
            $product = Product::findorfail($this->request->get('product_id'));
        }

        if (isset($product) && $product->type == 'VARIABLE_PRODUCT') {
            $rule['name'] = 'required|max:255';
            $rule ['price'] = 'required|max:14|regex:/^-?\\d*(\\.\\d+)?$/';
            $rule['sku'] = 'required|max:255';
            $rule['qty'] = 'required';
        } else {
            $rule['name'] = 'required|max:255';
            $rule ['price'] = 'required|max:14|regex:/^-?\\d*(\\.\\d+)?$/';
            $rule['sku'] = 'required|max:255';
            //$rule['page_title'] = "max:255";
            //$rule['page_description'] = "max:255";
            $rule['description'] = 'required';
            $rule['status'] = 'required';
            $rule['is_taxable'] = 'required';
            $rule['in_stock'] = 'required';
            $rule['track_stock'] = 'required';

            //@todo category validation
            if (strtolower($this->method()) == 'put' || strtolower($this->method()) == 'patch') {

                //$product = Product::find($this->route('product'));
                //$rule['slug'] = "required|max:255|alpha_dash|unique:products,slug," . $product->id;
            }
        }

        return $rule;
    }
737842
public function rules()
    {
        $validationRule = [];
        $validationRule['name'] = 'required|max:255';
        $validationRule['content'] = 'required';
        if ($this->getMethod() == 'POST') {
            $validationRule['slug'] = 'required|max:255|alpha_dash|unique:pages';
        }
        if ($this->getMethod() == 'PUT') {
            $validationRule['slug'] = 'required|max:255|alpha_dash';
        }

        return $validationRule;
    }
164703
public function validate(): array
	{
		if($this->isInvalid())
		{
			throw new ValidationException($this->errors, 'Invalid input.');
		}

		$validated = [];

		foreach(array_keys($this->ruleSets) as $validatedKey)
		{
			if(Arr::has($this->input, $validatedKey))
			{
				Arr::set($validated, $validatedKey, Arr::get($this->input, $validatedKey));
			}
		}

		return $validated;
	}
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;
    }
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'
        ];
    }
459338
public function rules()
    {

        //$userRepository = new UserRepository($this->app);
        $user = $this->users->findBy('id', $this->route('user'));

        return [
            'username' => 'required|max:255|unique:users,username,'.$user->id,
            'email' => 'required|email|max:255|unique:users,email,'.$user->id,
        ];
    }
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];
    }
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;
    }
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'
        ];
    }
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;
    }
890492
public function validateRules()
    {
        $input = request()->all();
        $rules = [];
        $messages = [];

        if ($this->formRequest) {
            $this->formRequest = new $this->formRequest;
            $rules = $this->formRequest->rules();
            $messages = $this->formRequest->messages();
        }

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

        return array_merge($event->getRules(), [
            'duration' => 'required',
        ]);
    }
476291
public function getValidatorMessages()
    {
        $messages = [];
        
        foreach ($this->owner->getValidatorRules() as $rule) {
            
            if ($rule->hasMessage()) {
                $messages[$rule->getType()] = $rule->getMessage();
            }
            
        }
        
        return $messages;
    }