Fix attribute models
This commit is contained in:
parent
ddcb68c944
commit
8639091d06
|
@ -38,6 +38,7 @@ class Attribute extends Model
|
|||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Is attribute an array?',
|
||||
'default' => false,
|
||||
'required' => false,
|
||||
'example' => false,
|
||||
])
|
||||
;
|
||||
|
|
|
@ -28,6 +28,7 @@ class AttributeBoolean extends Attribute
|
|||
'type' => self::TYPE_BOOLEAN,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => false
|
||||
])
|
||||
;
|
||||
|
|
|
@ -29,7 +29,6 @@ class AttributeDatetime extends Attribute
|
|||
'default' => APP_DATABASE_ATTRIBUTE_DATETIME,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_DATETIME,
|
||||
'array' => false,
|
||||
'require' => true,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
|
@ -37,7 +36,7 @@ class AttributeDatetime extends Attribute
|
|||
'default' => null,
|
||||
'example' => self::TYPE_DATETIME_EXAMPLE,
|
||||
'array' => false,
|
||||
'require' => false,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
|
|
@ -27,14 +27,14 @@ class AttributeEmail extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'email',
|
||||
'example' => 'email',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_EMAIL,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_EMAIL,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'default@example.com',
|
||||
])
|
||||
;
|
||||
|
|
|
@ -34,14 +34,14 @@ class AttributeEnum extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'enum',
|
||||
'example' => 'enum',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_ENUM,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_ENUM,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'element',
|
||||
])
|
||||
;
|
||||
|
|
|
@ -28,18 +28,21 @@ class AttributeFloat extends Attribute
|
|||
'type' => self::TYPE_FLOAT,
|
||||
'description' => 'Minimum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 1.5,
|
||||
])
|
||||
->addRule('max', [
|
||||
'type' => self::TYPE_FLOAT,
|
||||
'description' => 'Maximum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 10.5,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_FLOAT,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 2.5,
|
||||
])
|
||||
;
|
||||
|
|
|
@ -27,14 +27,14 @@ class AttributeIP extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'ip',
|
||||
'example' => 'ip',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_IP,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_IP,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => '192.0.2.0',
|
||||
])
|
||||
;
|
||||
|
|
|
@ -28,18 +28,21 @@ class AttributeInteger extends Attribute
|
|||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Minimum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 1,
|
||||
])
|
||||
->addRule('max', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Maximum value to enforce for new documents.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 10,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_INTEGER,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 10,
|
||||
])
|
||||
;
|
||||
|
|
|
@ -22,6 +22,7 @@ class AttributeString extends Attribute
|
|||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'default',
|
||||
])
|
||||
;
|
||||
|
|
|
@ -27,14 +27,14 @@ class AttributeURL extends Attribute
|
|||
->addRule('format', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'String format.',
|
||||
'default' => 'url',
|
||||
'example' => 'url',
|
||||
'required' => true,
|
||||
'default' => APP_DATABASE_ATTRIBUTE_URL,
|
||||
'example' => APP_DATABASE_ATTRIBUTE_URL,
|
||||
])
|
||||
->addRule('default', [
|
||||
'type' => self::TYPE_STRING,
|
||||
'description' => 'Default value for attribute when not provided. Cannot be set when attribute is required.',
|
||||
'default' => null,
|
||||
'required' => false,
|
||||
'example' => 'http://example.com',
|
||||
])
|
||||
;
|
||||
|
|
|
@ -41,6 +41,7 @@ class Index extends Model
|
|||
'default' => [],
|
||||
'example' => [],
|
||||
'array' => true,
|
||||
'required' => false,
|
||||
])
|
||||
;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue