openvk/Web/Models/Repositories/Vouchers.php

20 lines
502 B
PHP
Raw Normal View History

<?php declare(strict_types=1);
namespace openvk\Web\Models\Repositories;
use openvk\Web\Models\Entities\Voucher;
class Vouchers extends Repository
{
protected $tableName = "coin_vouchers";
protected $modelName = "Voucher";
function getByToken(string $token, bool $withDeleted = false)
{
$voucher = $this->table->where([
"token" => $token,
"deleted" => $withDeleted,
])->fetch();
return $this->toEntity($voucher);
}
}