<?php

namespace app\admin\model\mall;

use app\common\model\traits\TimestampInteger;
use support\think\Model;

/**
 * Player
 */
class Player extends Model
{
    use TimestampInteger;

    // 表名
    protected $name = 'mall_player';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = true;

    /**
     * 重置密码
     */
    public function resetPassword(int $id, string $newPassword): bool
    {
        return $this->where(['id' => $id])->update(['password' => hash_password($newPassword)]) !== false;
    }
}