图形验证码
使用
use JoyceZ\LaravelLib\Helpers\ResultHelper;
use JoyceZ\LaravelLib\Contracts\Captcha as CaptchaInterface;
class Passport extends Controller {
/**
* 获取图形验证码
* @param CaptchaInterface $captchaRepo
* @return array
*/
public function captcha(CaptchaInterface $captchaRepo)
{
$captcha = $captchaRepo->makeCode()->get();
$captchaImg = Arr::get($captcha, 'image', '');
$captchaUniqid = Arr::get($captcha, 'uniq', '');
return ResultHelper::returnFormat('success', ResponseCode::SUCCESS, [
'captcha' => $captchaImg,
config('laraveladmin.passport.check_captcha_cache_key') => $captchaUniqid
]);
}
}