Add captcha image generation functionality.
This commit is contained in:
31
app/Http/Resources/Api/V1/Captcha.php
Normal file
31
app/Http/Resources/Api/V1/Captcha.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Resources\Api\V1;
|
||||
|
||||
use App\ServiceResults\Api\V1\CaptchaService\Captcha as CaptchaResult;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
final class Captcha extends JsonResource
|
||||
{
|
||||
|
||||
/**
|
||||
* @var CaptchaResult
|
||||
*/
|
||||
public $resource;
|
||||
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'image_base64' => $this->resource->getImageBase64(),
|
||||
'image_text_base64' => $this->resource->getImageTextBase64(),
|
||||
'captcha_key' => $this->resource->getKey()
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user