Revived API /api/v1/captcha.
Now a new captcha is created to check for a bot.
This commit is contained in:
37
app/Models/Captcha.php
Normal file
37
app/Models/Captcha.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
final class Captcha extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'captchas';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'uuid',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'uuid',
|
||||
];
|
||||
|
||||
public function captchaLogs(): HasMany
|
||||
{
|
||||
return $this->hasMany(CaptchaLog::class);
|
||||
}
|
||||
}
|
37
app/Models/CaptchaLog.php
Normal file
37
app/Models/CaptchaLog.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\CaptchaLogType;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
final class CaptchaLog extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $table = 'captcha_logs';
|
||||
|
||||
const UPDATED_AT = null;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'ip',
|
||||
'user_agent',
|
||||
'referer',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'type' => CaptchaLogType::class,
|
||||
];
|
||||
}
|
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
final class CaptchaToken extends Model
|
||||
@@ -30,4 +31,9 @@ final class CaptchaToken extends Model
|
||||
'public_token',
|
||||
'private_token',
|
||||
];
|
||||
|
||||
public function captchas(): HasMany
|
||||
{
|
||||
return $this->hasMany(Captcha::class);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user