feat: 添加 Laravel Sanctum 支持,增强管理员 API 鉴权,更新相关中间件与路由配置
This commit is contained in:
25
app/Http/Controllers/Api/V1/Admin/Auth/CaptchaController.php
Normal file
25
app/Http/Controllers/Api/V1/Admin/Auth/CaptchaController.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Auth;
|
||||
|
||||
use App\Services\AdminCaptchaService;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
/**
|
||||
* GET /api/v1/admin/auth/captcha
|
||||
*
|
||||
* 返回一次性验证码 Key 与 SVG(Base64 便于前台直接赋值给 img.src)。
|
||||
*/
|
||||
final class CaptchaController
|
||||
{
|
||||
public function __invoke(AdminCaptchaService $captcha): JsonResponse
|
||||
{
|
||||
$payload = $captcha->create();
|
||||
|
||||
return ApiResponse::success([
|
||||
'captcha_key' => $payload['captcha_key'],
|
||||
'image_base64' => $payload['image_base64'],
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user