Source: bhargavraviya.medium.com

How To Laravel Forms Adding Google reCAPTCHA v3

Category: Laravel

Within your tags, add , then add the following to your page scripts: Note the {action: 'contact'} part, you can specify different actions for different parts of your website and see the data in your admin console. Also note the lines containing {{ config('services.recaptcha.sitekey')}}, you could simply paste your site key here, but it's better to set these in config and env files. So, in config/services.php in your Laravel project, add the following at the end of the file: Then in your .env file, add the following: Replace YOUR_RECAPTCHA_SECRET_KEY and YOUR_RECAPTCHA_SITE_KEY with the keys from your reCAPTCHA admin panel that were generated earlier. So in your controller that manages your contact form, within the method that sends your form data, (for example, the store() method in a ContactController), we need to add the following: If we were to dd($resultJson); in the example above, it would return something like: I am Laravel and Digital Marketing Expert and follow blog on raviyatechnical.blogspot.com I am Laravel and Digital Marketing Expert and follow blog on raviyatechnical.blogspot.com
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners