<?php
declare (strict_types = 1);

namespace app\openapi\model;

use think\Model;

/**
 * @mixin \think\Model
 */
class OAuthRefreshTokenModel extends Model
{
    // 表名
    protected $name = 'oauth_refresh_token';

    // 字段信息
    protected $schema = [
        'id'            => 'int',
        'client_id'     => 'string',
        'user_id'       => 'int',
        'refresh_token' => 'string',
        'expires'       => 'int',
        'scope'         => 'string',
        'created_at'    => 'datetime'
    ];

    // refresh_token范围查询
    public function scopeRefreshToken($query, $refresh_token)
    {
        $query->where('refresh_token', '=', $refresh_token);
    }
}
