-
Docs
Backend
-
Behaviors
-
Classes
-
Controllers
-
Database
-
Seeds
-
-
Facades
-
FormWidgets
-
Helpers
-
Exception
- Backend
-
-
Models
-
ReportWidgets
-
Skins
-
Traits
-
Widgets
- ServiceProvider
-
-
Cms
-
Classes
- Asset
- AutoDatasource
- CmsCompoundObject
- CmsController
- CmsException
- CmsObject
- CmsObjectCollection
- CodeBase
- CodeParser
- ComponentBase
- ComponentHelpers
- ComponentManager
- ComponentPartial
- Content
- Controller
- Layout
- LayoutCode
- MediaLibrary
- MediaLibraryItem
- MediaViewHelper
- Meta
- ObjectMemoryCache
- Page
- PageCode
- Partial
- PartialCode
- PartialStack
- Router
- Theme
- ThemeManager
-
Components
-
Contracts
-
Controllers
-
Facades
-
FormWidgets
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ComponentNode
- ComponentTokenParser
- ContentNode
- ContentTokenParser
- DebugExtension
- DefaultNode
- DefaultTokenParser
- Extension
- FlashNode
- FlashTokenParser
- FrameworkNode
- FrameworkTokenParser
- Loader
- PageNode
- PageTokenParser
- PartialNode
- PartialTokenParser
- PlaceholderNode
- PlaceholderTokenParser
- PutNode
- PutTokenParser
- ScriptsNode
- ScriptsTokenParser
- StylesNode
- StylesTokenParser
-
Widgets
- ServiceProvider
-
-
System
-
Behaviors
-
Classes
-
Console
-
Controllers
-
Database
-
Helpers
-
Models
-
ReportWidgets
-
Traits
-
Twig
- ServiceProvider
-
-
Events
-
backend
-
ajax
-
filter
-
form
-
list
-
menu
-
page
-
user
-
-
cms
-
ajax
-
block
-
combiner
-
component
-
object
-
page
-
router
-
template
-
theme
-
-
halcyon
-
datasource
-
-
mailer
-
media
-
model
-
system
-
assets
-
console
-
mirror
-
theme
-
-
reportwidgets
-
settings
- extendConfigFile
-
-
translator
-
-
Library
-
Argon
-
Auth
-
Models
- AuthException
- Manager
-
-
Config
-
Cookie
-
Middleware
-
-
Database
-
Attach
-
Behaviors
-
Concerns
-
Connections
-
Connectors
-
Models
-
Relations
-
Schema
-
Traits
-
Updates
- README
- Builder
- Collection
- DatabaseServiceProvider
- DataFeed
- Dongle
- MemoryCache
- Model
- ModelBehavior
- ModelException
- NestedTreeScope
- Pivot
- QueryBuilder
- SortableScope
- TreeCollection
- Updater
-
-
Events
-
Exception
-
Extension
-
Filesystem
-
Flash
-
Foundation
-
Bootstrap
-
Console
-
Exception
-
Http
-
Middleware
- Kernel
-
-
Providers
- Application
- Maker
-
-
Halcyon
-
Datasource
-
Exception
-
Processors
-
Traits
- README
- Builder
- Collection
- HalcyonServiceProvider
- MemoryCacheManager
- MemoryRepository
- Model
-
-
Html
-
Mail
-
Network
-
Parse
-
Router
-
Scaffold
-
Support
-
Translation
-
- Documentation
- API
- Library
- Database
- Traits
- Validation
October\Rain\Database\Traits\Validation
Source: ~/vendor/october/rain/src/Database/Traits/Validation.php
Protected properties
protected Illuminate\Support\MessageBag $validationErrors
The message bag instance containing validation error messages
protected array $validationDefaultAttrNames
Default custom attribute names.
Public methods
public static void bootValidation()
Boot the validation trait for this model.
public Illuminate\Support\MessageBag errors()
Get validation error message collection for the Model
public bool forceSave($options=NULL, $sessionKey=NULL)
Force save the model even if validation fails.
Parameters
- $options
- $sessionKey
public boolean isAttributeRequired(string $attribute, boolean $checkDependencies=true)
Determines if an attribute is required based on the validation rules.
Parameters
- string $attribute
- boolean $checkDependencies - Checks the attribute dependencies (for required_if & required_with rules). Note that it will only be checked up to the next level, if another dependent rule is found then it will just assume the field is required
public void setValidationAttributeName(string $attr, string $name)
Programatically sets the validation attribute names, will take lower priority
to model defined attribute names found in $attributeNames
.
Parameters
- string $attr
- string $name
public void setValidationAttributeNames(array $attributeNames)
Programatically sets multiple validation attribute names.
Parameters
- array $attributeNames
public bool validate($rules=NULL, $customMessages=NULL, $attributeNames=NULL)
Validate the model instance
Parameters
- $rules
- $customMessages
- $attributeNames
public static void validated(Closure|string $callback)
Create a new native event for handling afterValidate().
Parameters
- Closure|string $callback
public static void validating(Closure|string $callback)
Create a new native event for handling beforeValidate().
Parameters
- Closure|string $callback
Protected methods
protected void getRelationValidationValue($relationName)
Attachments validate differently to their simple values.
Parameters
- $relationName
protected array getValidationAttributes()
Returns the model data used for validation.
protected static Illuminate\Validation\Validator makeValidator($data, $rules, $customMessages, $attributeNames, $connection=NULL)
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.
Parameters
- $data
- $rules
- $customMessages
- $attributeNames
- $connection
protected array processRuleFieldNames(array $rules)
Processes field names in a rule array.
Converts any field names using array notation (ie. field[child]
) into dot notation (ie. field.child
)
Parameters
- array $rules - Rules array
protected void processValidationRules($rules)
Process rules
Parameters
- $rules
protected string processValidationUniqueRule(string $definition, string $fieldName)
Rebuilds the unique validation rule to force for the existing ID
Parameters
- string $definition
- string $fieldName