<?php

namespace nota\models;

use Yii;

class Voucher extends \yii\db\ActiveRecord
{
    public static function getDb() {
        return Yii::$app->get('dbnota'); 
    }

    public static function tableName()
    {
        return 'voucher';
    }

    public function rules()
    {
        return [
            [['kode', 'type', 'value'], 'required'],
            ['kode', 'string', 'max' => 50],
            ['type', 'in', 'range' => ['nominal','percent']],
            ['value', 'number', 'min' => 0],
            ['active', 'boolean'],
        ];
    }
}
