forked from wartron/yii2-account-billing
/
BillableItem.php
49 lines (39 loc) · 1.09 KB
/
BillableItem.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace wartron\yii2account\billing\models;
use Exception;
use Yii;
class BillableItem extends \wartron\yii2uuid\db\ActiveRecord
{
const STATUS_INACTIVE = 0;
const STATUS_ACTIVE = 1;
const TYPE_MISC = 0;
const TYPE_RECURRING = 10;
/** @inheritdoc */
public function init()
{
parent::init();
}
/** @inheritdoc */
public static function tableName()
{
return 'billing_item';
}
/** @inheritdoc */
public function behaviors()
{
return [
\yii\behaviors\TimestampBehavior::className(),
\yii\behaviors\BlameableBehavior::className(),
];
}
/** @inheritdoc */
public function rules()
{
return [
[['name', 'amount', 'type', 'status'], 'required'],
[['amount', 'type', 'status', 'created_at', 'updated_at'], 'integer'],
[['description'], 'string', 'max' => 255],
[['data'], 'string', 'max' => 10*1024],
];
}
}