First Commit

This commit is contained in:
marco
2026-09-01 09:22:30 -03:00
commit a43ae23eb4
407 changed files with 36138 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Session;
class CaptchaController extends Controller
{
/**
* Generate a new arithmetic captcha.
*/
public function generate(Request $request): \Illuminate\Http\JsonResponse
{
$a = random_int(1, 20);
$b = random_int(1, 20);
$operations = ['+', '-', '*'];
$operation = $operations[array_rand($operations)];
if ($operation === '+') {
$answer = $a + $b;
} elseif ($operation === '-') {
$answer = $a - $b;
} else {
$answer = $a * $b;
}
$expression = "{$a} {$operation} {$b} = ?";
Session::put('captcha_answer', (string) $answer);
return response()->json([
'expression' => $expression,
]);
}
}