[L6] Add support for custom model validation logic

This commit is contained in:
Dane Everitt 2019-09-04 22:19:57 -07:00
parent 5b4a65a60c
commit c586157dc4
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
19 changed files with 226 additions and 330 deletions

View file

@ -44,31 +44,18 @@ class DatabaseHost extends Validable
'node_id' => 'integer',
];
/**
* Application validation rules.
*
* @var array
*/
protected static $applicationRules = [
'name' => 'required',
'host' => 'required',
'port' => 'required',
'username' => 'required',
'node_id' => 'sometimes',
];
/**
* Validation rules to assign to this model.
*
* @var array
*/
protected static $dataIntegrityRules = [
'name' => 'string|max:255',
'host' => 'ip|unique:database_hosts,host',
'port' => 'numeric|between:1,65535',
'username' => 'string|max:32',
public static $validationRules = [
'name' => 'required|string|max:255',
'host' => 'required|ip|unique:database_hosts,host',
'port' => 'required|numeric|between:1,65535',
'username' => 'required|string|max:32',
'password' => 'nullable|string',
'node_id' => 'nullable|integer|exists:nodes,id',
'node_id' => 'sometimes|nullable|integer|exists:nodes,id',
];
/**