Open gaurav-garry opened 7 years ago
try this:
Route::get('captcha', function () {
$res = app('captcha')->create('default', true);
return $res;
});
Route::post('check_captcha', function (Request $req) {
$captcha = $req->input('captcha');
$key = $req->input('key');
$res = captcha_api_check($captcha, $key);
dump($res);
});
If you're trying to use validator, try this:
Route::post('check_captcha', function (Request $req) {
$data = $req->all();
$validator = Validator::make($data, [
'ckey' => 'required',
'captcha' => 'required|captcha_api:' . $req->input('ckey')
]);
if ($validator->fails()) {
return [
'msg' => 'Validation failed',
'errors' => $validator->messages(),
];
} else {
return [
'msg' => 'Validation passes'
];
}
});
如何让这玩意儿过期
如何让这玩意儿过期
https://github.com/mewebstudio/captcha/issues/176 api调用方式 缓存,并让其过期
I am new to laravel and writing a REST API to register the users. But I want to include the captcha in the form. I can make a query to load the image and use the same in image tag on frontend. When I post the request back, I want to validate the captcha. How can I do it?