Revived API POST /api/v1/captcha.
Captcha validation has been adjusted.
This commit is contained in:
20
app/Repositories/CaptchaLogRepository.php
Normal file
20
app/Repositories/CaptchaLogRepository.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Enums\CaptchaLogType;
|
||||
use App\Models\CaptchaLog;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
final class CaptchaLogRepository
|
||||
{
|
||||
public function countByType(CaptchaLogType $type, ?int $captchaId = null): int
|
||||
{
|
||||
return CaptchaLog::query()
|
||||
->when($captchaId, function (Builder $query, int $captchaId) {
|
||||
$query->where('id', $captchaId);
|
||||
})
|
||||
->where('type', '=', $type)
|
||||
->count();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user