<?php

namespace Modules\User\Models\Traits;

use Illuminate\Database\Eloquent\Builder;
use Modules\User\Models\Identity;

trait HasIdentityScopes
{

    /**
     * Notes: 免费会员
     *
     * @Author: 玄尘
     * @Date: 2022/8/18 15:25
     * @param  Builder  $query
     * @return Builder
     */
    public function scopeFreeVip(Builder $query): Builder
    {
        return $query->where('job', Identity::JOB_FREE_VIP);
    }

    /**
     * Notes: 月卡
     *
     * @Author: 玄尘
     * @Date: 2022/8/18 15:25
     * @param  Builder  $query
     * @return Builder
     */
    public function scopeYk(Builder $query): Builder
    {
        return $query->where('job', Identity::JOB_YK);
    }

    /**
     * Notes: 季卡
     *
     * @Author: 玄尘
     * @Date: 2022/8/18 15:26
     * @param  Builder  $query
     * @return Builder
     */
    public function scopeJk(Builder $query): Builder
    {
        return $query->where('job', Identity::JOB_JK);
    }

    /**
     * Notes: 年卡
     *
     * @Author: 玄尘
     * @Date: 2022/8/18 15:27
     * @param  Builder  $query
     * @return Builder
     */
    public function scopeNk(Builder $query): Builder
    {
        return $query->where('job', Identity::JOB_NK);
    }

}
