A captcha that will be used for multiple pages/places in single website.
composer require jbrathod/math-captcha
Find the providers
key in config/app.php
and register the Captcha Service Provider.
'providers' => [
// ...
'Jbrathod\MathCaptcha\MathCaptchaServiceProvider',
]
for Laravel 5.1+
'providers' => [
// ...
Jbrathod\MathCaptcha\MathCaptchaServiceProvider::class,
]
<img src="{{ app('mathcaptcha')->image('contact-us') }}"/>
Add 'captcha' => 'required|mathcaptcha:contact-us'
to rules array.
$this->validate($request, [
'captcha' => 'required|mathcaptcha:contact-us',
]);
app('mathcaptcha')->reset('contact-us');