Completed
Push — master ( 92156c...43c17e )
by Andrii
25:32 queued 10:20
created

Aggregate::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\models;
12
13
use hipanel\base\Model;
14
use hipanel\base\ModelTrait;
15
use Yii;
16
17
class Aggregate extends Model
18
{
19
    use ModelTrait;
20
21
    /** {@inheritdoc} */
22
    public function rules()
23
    {
24
        return array_merge(parent::rules(), [
25
            [['id', 'client_id', 'seller_id'], 'integer'],
26
            [['note', 'rir', 'state', 'type', 'client', 'seller'], 'string'],
27
            [['ip'], 'ip', 'subnet' => null],
28
29
            [['ip', 'rir'], 'required', 'on' => ['create', 'update']],
30
            [['id'], 'required', 'on' => ['update']],
31
        ]);
32
    }
33
34
    /** {@inheritdoc} */
35
    public function attributeLabels()
36
    {
37
        return $this->mergeAttributeLabels([
38
            'ip' => Yii::t('hipanel.hosting.ipam', 'Prefix'),
39
            'rir' => Yii::t('hipanel.hosting.ipam', 'RIR'),
40
            'note' => Yii::t('hipanel.hosting.ipam', 'Description'),
41
        ]);
42
    }
43
}
44