[L6] Add support for custom model validation logic
This commit is contained in:
parent
5b4a65a60c
commit
c586157dc4
19 changed files with 226 additions and 330 deletions
|
@ -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',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue