Revived API /api/v1/captcha.
Now a new captcha is created to check for a bot.
This commit is contained in:
44
database/migrations/2023_08_27_163058_create_captcha.php
Normal file
44
database/migrations/2023_08_27_163058_create_captcha.php
Normal 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');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user