2025-01-31 18:20:13 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2021-10-07 11:47:30 +03:00
|
|
|
namespace openvk\Web\Models\Repositories;
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2021-10-07 11:47:30 +03:00
|
|
|
use openvk\Web\Models\Entities\Voucher;
|
|
|
|
|
|
|
|
class Vouchers extends Repository
|
|
|
|
{
|
|
|
|
protected $tableName = "coin_vouchers";
|
|
|
|
protected $modelName = "Voucher";
|
2025-01-31 18:20:13 +03:00
|
|
|
|
|
|
|
public function getByToken(string $token, bool $withDeleted = false)
|
2021-10-07 11:47:30 +03:00
|
|
|
{
|
|
|
|
$voucher = $this->table->where([
|
|
|
|
"token" => $token,
|
|
|
|
"deleted" => $withDeleted,
|
|
|
|
])->fetch();
|
2025-01-31 18:20:13 +03:00
|
|
|
|
2021-10-07 11:47:30 +03:00
|
|
|
return $this->toEntity($voucher);
|
|
|
|
}
|
|
|
|
}
|