MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

How to enable Google reCaptcha with Laravel?

Step 1 – First go to https://www.google.com/recaptcha/intro/v3.html then click on Admin console

Step 2 – Genereate new recaptcha (click on + button to create)

  1. Type label name
  2. Select ReCaptcha v2 â–º select “I’m not a robot” Checkbox
  3. Domains (localhost) or your website address eg www.example.com
  4. Accept the ReCaptcha term of service ( tick checkbox)
  5. send alerts to owners (tick checkbox already) â–º click on submit button

Step 3 – after that you will see site key – like this
(6LdtjbYUAAAAANm-tqllPU_O-rHyZ-0HwR0COkYk)

Step 4 – and secret key like this (6LdtjbYUAAAAABDNEWDL2EgBN2pq76AdgHQoLx77)

Step 5 – copy both keys in notepad.

Step 6 -Put below javascript code in resources/views/layouts/app.blade.php

Step 7 – and put below code in your form area above submit button

@if(errors->has(‘g-recaptcha-response’))

{{$errors->first(‘g-captcha-response’)}}

@endif

Step 8 – open any terminal like gitbash or PowerShell and type this command (composer require google/recaptcha ‘~1.1’ press enter
â–º then run command php artisan make:rule Captcha (press enter)
â–º then open app/Rules/Captcha.php and add below lines

use ReCaptcha\ReCaptcha;

â–º and add below codes to Captcha.php

public function passes($attribute, $value)
{
$recaptcha = new ReCaptcha(env(‘CAPTCHA_SECRET’));
$response = $recaptcha->verify($value, $_SERVER[‘REMOTE_ADDR’]);
return $response->isSuccess();
}
—–
public function message()
{
return ‘Please complete the recaptcha to submit the form’;
}

Step 9 – and add below lines to app/Http/User/JobController.php

use App\Rules\Captcha;

Step 10 – and add under validator ‘g-captcha-response’ => new Captcha(),

If you have any query then comment us we will solve your issue and give you also some awesome steps and tricks to solve it. Please follow us for future reference on other topics like PHP, Laravel and other languages.

For More reference Please check this out :

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
MotoShare.in provides the perfect two-wheeler for every occasion—daily commuting, weekend escapes, tourist exploration, or test-riding your dream bike. Simplify your mobility with us!

Related Posts

Laravel: oauth_access_tokens clean up process

using Laravel Passport—the oauth_access_tokens table balloons when tokens aren’t expiring, not being revoked on logout, or not being purged. Here’s a practical, safe cleanup + prevention plan…

Read More

Laravel: Complete Guide of Laravel Passport

Here’s a comprehensive, up-to-date step-by-step tutorial for setting up and using Laravel Passport (OAuth2 API authentication) with clear explanations, working code samples, and troubleshooting tips—suitable for local…

Read More

Laravel: What is APP_KEY in Laravel?

Let’s break down both what APP_KEY is in a Laravel .env file, why it matters, and its use cases. I’ll also explain how it’s generated and what…

Read More

artisan Tutorials: php artisan passport

When you run php artisan passport:install, Laravel attempts to do the following: Running php artisan passport:install is a crucial setup step when using Laravel Passport for API…

Read More

An introduction of Laravel Boilerplate

Laravel Boilerplate is a comprehensive starter kit designed to accelerate the development of Laravel applications by providing a robust foundation with pre-integrated features. Developed by Rappasoft, it…

Read More

Why You Should Avoid Laravel Spark and Stripe/Paddle for Certain Use Cases

✅ Explains why Laravel Spark is not suitable in certain use cases✅ Clarifies the limitations of Stripe and Paddle✅ Lists unsupported countries✅ Guides developers toward the right…

Read More