<?php

namespace App\Models;

/**
 * App\Models\RecodeModel
 *
 * @property int $id 主键
 * @property int $uid 用户id
 * @property int $partner_id 卖室友卡片id
 * @property int $create_at 操作时间
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel whereCreateAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel wherePartnerId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RecodeModel whereUid($value)
 * @mixin \Eloquent
 */
class RecodeModel extends Model
{
    protected $table = 'kdgx_partner_charge_recode';

    public $timestamps = false;

    public $fillable = ['uid', 'partner_id', 'create_at'];

    /**
     * 是否解锁卡片
     * @param  int  $uid
     * @param  int  $partner_id
     * @return bool
     */
    public function isLock(int $uid, int $partner_id)
    {
        if (
            $this->where([
            ['uid', $uid],
            ['partner_id', $partner_id]
            ])->exists()
        ) {
            return true;
        } else {
            return false;
        }
    }
}
