<?php

namespace App\Classes\Modules\Vouchers\Services;

use App\Models\Voucher;

class CheckIfVoucherExists
{

    /** @var Voucher */
    private $repository;


    /**
     * CheckIfVoucherExists constructor.
     * @param Voucher $repository
     */
    public function __construct(Voucher $repository)
    {
        $this->repository = $repository;
    }

    public function execute(string $code): bool {
        return $this->repository->where('code', $code)->exists();
    }

}
