<?php

namespace App\Classes\General\Eloquent\Filters;

use App\Models\Booking;
use Illuminate\Database\Eloquent\Builder;

class TransactionServiceId implements Filter
{

    /**
     * @param Builder $builder
     * @param $value
     * @return Builder|mixed
     */
    public static function apply(Builder $builder, $value)
    {
        return $builder->where('owner_type', Booking::class)->whereHas('booking', function ($query) use($value) {
            $query->where('service_id', $value);
        });
    }

}