<?php

namespace App\Classes\General\Eloquent\Filters;


use App\Classes\ValueObjects\Constants\ApprovalStatus;
use Illuminate\Database\Eloquent\Builder;

class HasPendingVerifyTransaction implements Filter
{

    /**
     * @param Builder $builder
     * @param $value
     * @return mixed
     */
    public static function apply(Builder $builder, $value)
    {
        return $builder->whereHas('transactions', function ($q) {
            $q->where('status', ApprovalStatus::PENDING_VERIFICATION);
        });
    }
}