RuleInjector
trait RuleInjector
Methods
Returns whether or not the model will add it's unique identifier to the rules when validating.
Set the model to add unique identifier to rules when performing validation.
If the model already exists and it has unique validations it is going to fail validation unless we also pass it's primary key to the rule so that it may be ignored.
Get the dynamic method name for a unique identifier or custom injector rule if it exists, otherwise return false.
Prepare a rule, adding the table name, column and model identifier if required.
Prepare a unique_with rule, adding the model identifier if required.
Details
at line 15
bool
getInjectRuleParameters()
Returns whether or not the model will add it's unique identifier to the rules when validating.
at line 27
void
setInjectRuleParameters(bool $value)
Set the model to add unique identifier to rules when performing validation.
at line 44
protected array
injectParametersToRules(array $rules)
If the model already exists and it has unique validations it is going to fail validation unless we also pass it's primary key to the rule so that it may be ignored.
This will go through all the rules and append the model's primary key to the unique rules so that the validation will work as expected.
at line 76
protected mixed
getRuleInjectorMethod(string $validationRule)
Get the dynamic method name for a unique identifier or custom injector rule if it exists, otherwise return false.
at line 91
protected string
prepareUniqueRule(array $parameters, string $field)
Prepare a rule, adding the table name, column and model identifier if required.
at line 140
protected string
prepareUniqueWithRule(array $parameters, string $field)
Prepare a unique_with rule, adding the model identifier if required.