Files
exchange-2.0/app/Classes/Modules/Vouchers/Services/CheckIfVoucherExists.php
T
2023-05-30 22:02:09 +08:00

28 lines
486 B
PHP

<?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();
}
}