mewebstudio / captcha

Captcha for Laravel 5/6/7/8/9/10/11
MIT License
2.46k stars 452 forks source link

Better docs for Stateless Mode. Where does request('key') come from? #222

Open anthonybudd opened 3 years ago

anthonybudd commented 3 years ago

Can you provide better docs for Stateless mode?

How am I meant to get the $key param? Should that be sent by the user in the form request or is this retrieved by the back-end in a different?

very confusing?

pl1998 commented 3 years ago

//api function

public function captcha()
    {
        return $this->success(['captcha'=>app('captcha')->create('default', true)]);
    }

//check api key

   if(!captcha_api_check(\request('captcha'),\request('key')))
        {
            return $this->fail('captcha error',40001);
        }