<?php

/**
 * @link      http://www.u-bo.com
 * @copyright 南京友博网络科技有限公司 
 * @license   http://www.u-bo.com/license/
 */

namespace qcbase\models;

use Yii;

/**
 * 用户附表
 *
 * @property integer $user_id  (用户id 与user表user_id关联)
 * @property string $phone  (手机)
 * @property string $qq  (QQ)
 * @property text $remark  (备注)
 * 
 * @author legendjw http://blog.u-bo.com
 * @since 0.1
 */
class UserInfo extends \yii\db\ActiveRecord
{

    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%user_info}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['remark'], 'string'],
            [['phone', 'qq'], 'number']
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'user_id' => '用户id ',
            'phone' => '手机',
            'qq' => 'QQ',
            'remark' => '备注',
        ];
    }

    public function afterSave($insert, $changedAttributes)
    {
        parent::afterSave($insert, $changedAttributes);
        \qcbase\models\ActionLog::insertLog('home', '修改', json_encode($changedAttributes));
    }

}
