src/Validation.php
protected function interpolateValidationRules($rules, $model)
    {
        foreach ($rules as &$rule) {
            $attrs = last(chars_within($rule, ['{', '}']));

            foreach ($attrs as $attr) {
                $rule = str_replace(
                    '{'.$attr.'}',
                    // Useful for unique validation rule, which lets you check unique with exceptId parameter and
                    // other column keys combination. Example:
                    // 'name' => 'unique:parishes,name,{id},id,parish_category_id,{parish_category_id}'
                    is_null($model[$attr]) && $attr == $this->model->getKeyName() ? 'NULL' : $model[$attr],
                    $rule
                );
            }
        }

        return $rules;
    }
protected function interpolateValidationRules($rules, $model)
    {
        foreach ($rules as &$rule) {
            $attrs = last(chars_within($rule, ['{', '}']));

            foreach ($attrs as $attr) {
                $rule = str_replace(
                    '{'.$attr.'}',
                    // Useful for unique validation rule, which lets you check unique with exceptId parameter and
                    // other column keys combination. Example:
                    // 'name' => 'unique:parishes,name,{id},id,parish_category_id,{parish_category_id}'
                    is_null($model[$attr]) && $attr == $this->model->getKeyName() ? 'NULL' : $model[$attr],
                    $rule
                );
            }
        }

        return $rules;
    }
protected function interpolateValidationRules ( $ rules , $ model ) { foreach ( $ rules as & $ rule ) { $ attrs = last ( chars_within ( $ rule , [ '{' , '}' ] ) ) ; foreach ( $ attrs as $ attr ) { $ rule = str_replace ( '{' . $ attr . '}' , // Useful for unique validation rule, which lets you check unique with exceptId parameter and // other column keys combination. Example: // 'name' => 'unique:parishes,name,{id},id,parish_category_id,{parish_category_id}' is_null ( $ model [ $ attr ] ) && $ attr == $ this -> model -> getKeyName ( ) ? 'NULL' : $ model [ $ attr ] , $ rule ) ; } } return $ rules ; }
Interpolate model attribute values on validation rules.

@param  array $rules
@param  array $model
@return array
Interpolate model attribute values on validation rules .