<?php

namespace app\models;

use Yii;
use app\behaviours\ActiveRecordLogableBehavior;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;

/**
 * This is the model class for table "{{%labdeptmaster}}".
 *
 * @property integer $lab_dept_id
 * @property string $lab_dept_code
 * @property string $lab_dept_name
 * @property string $status
 * @property integer $create_time
 * @property integer $create_user
 * @property integer $update_time
 * @property integer $update_user
 */
class Departments extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%labdeptmaster}}';
    }

    /**
     * @inheritdoc
     */
	public function behaviors()
	{
		return [
			/*
			[
				'class' => ActiveRecordLogableBehavior::className(),
				'createdAtAttribute' => 'create_time',
				'updatedAtAttribute' => 'update_time',
				'value' => date('U'),
			],
			*/
			[
				'class' => TimestampBehavior::className(),
				'createdAtAttribute' => 'create_time',
				'updatedAtAttribute' => 'update_time',
				'value' => date('U'),
			],
		];
	}

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['lab_dept_code', 'lab_dept_name'], 'required'],
            [['lab_dept_code', 'lab_dept_name'], 'string'],
            [['create_time', 'create_user', 'update_time', 'update_user'], 'integer'],
            [['status'], 'string', 'max' => 1],
			[['record_date'], 'default', 'value' => strtotime(date('Y/m/d'))],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'lab_dept_id' => Yii::t('app', 'Lab Department ID'),
            'lab_dept_code' => Yii::t('app', 'Lab Department Code'),
            'lab_dept_name' => Yii::t('app', 'Lab Department Name'),
            'status' => Yii::t('app', 'Status'),
            'create_time' => Yii::t('app', 'Last Updated Time'),
            'create_user' => Yii::t('app', 'Last Updated By'),
            'update_time' => Yii::t('app', 'Last Updated Time'),
            'update_user' => Yii::t('app', 'Last Updated By'),
        ];
    }
}
