<?php

namespace app\common\model;

class UserFollowModel extends BaseModel
{
    // 设置表名
    protected $name = 'user_follow';

    //自动完成
    protected $autoWriteTimestamp = true;

    // 常量
    const TYPE = [1 => '电话', 2 => '微信/QQ', 3 => '其他'];

    const TYPE_MOBILE = 1;
    const TYPE_QQ     = 2;
    const TYPE_OTHER  = 3;

    public function getTypeTextAttr($value, $data)
    {
        return self::TYPE[$data['type']];
    }

    public function User()
    {
        return $this->hasMany(UserModel::class, "id", "user_id");
    }

}