Revived API /api/v1/captcha.

Now a new captcha is created to check for a bot.
This commit is contained in:
2023-09-19 14:27:33 +06:00
parent 56cd409301
commit 27046e6674
22 changed files with 525 additions and 101 deletions

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('captchas', function (Blueprint $table) {
$table->id();
$table->uuid('uuid');
$table->unsignedBigInteger('captcha_token_id')->index();
$table->foreign('captcha_token_id')->references('id')->on('captcha_tokens');
$table->timestamps();
$table->index('created_at');
$table->unique(['uuid', 'captcha_token_id']);
});
Schema::create('captcha_logs', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('captcha_id')->index();
$table->foreign('captcha_id')->references('id')->on('captchas');
$table->unsignedInteger('type')->index();
$table->ipAddress('ip')->nullable();
$table->string('user_agent')->nullable();
$table->text('referer')->nullable();
$table->timestamp('created_at')->index();
$table->index(['captcha_id', 'type']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('captcha_logs');
Schema::dropIfExists('captchas');
}
};