1. Go to this page and download the library: Download aryehraber/statamic-captcha library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Support;
use AryehRaber\Captcha\Contracts\CustomShouldVerify;
class MyCustomShouldVerify implements CustomShouldVerify
{
public function __invoke($event): ?bool
{
// bypass verification for authenticated users
if (auth()->check()) {
return false;
}
// bypass verification on dev environment
if (app()->environment('dev')) {
return false;
}
// bypass verification based on event form submission
if ($event instanceof \Statamic\Events\FormSubmitted) {
// return $event->submission;
}
// bypass verification based on login event
if ($event instanceof \Illuminate\Auth\Events\Login) {
// return $event->user;
}
// bypass verification based on user registration event
if ($event instanceof \Statamic\Events\UserRegistering) {
// return $event->user;
}
// bypass verification based on entry saving event
if ($event instanceof \Statamic\Events\EntrySaving) {
// return $event->entry;
}
}
}