<?php
declare (strict_types = 1);

namespace app\openapi\model;

use think\Model;

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

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

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