Rules
Attaching Rules
When defining a field on a resource, you may use therules method to attach validation rules to the field:
app/Nova/~Resource.php
rules method via an array or Closure:
Creation Rules
If you would like to define rules that only apply when a resource is being created, you may use thecreationRules method:
Update Rules
Likewise, if you would like to define rules that only apply when a resource is being updated, you may use theupdateRules method. If necessary, you may use resourceId place-holder within your rule definition. This place-holder will automatically be replaced with the primary key of the resource being updated:
After Validation Hooks
Nova also provides several methods that allow you to perform tasks after a resource has been validated, providing the opportunity to perform more custom validation before the resource is persisted to the database:The afterValidation Method
The afterValidation method will always be called after a resource has been validated during its creation or during an update. This method will be called before calling afterCreationValidation or afterUpdateValidation:
app/Nova/~Resource.php
The afterCreationValidation Method
The afterCreationValidation method will be called after a resource that is being created has been validated:
app/Nova/~Resource.php
The afterUpdateValidation Method
The afterUpdateValidation method will be called after a resource that is being updated has been validated:
app/Nova/~Resource.php