Laravel 5.7 Google reCAPTCHA Tutorial with Example

Today, We want to share with you Laravel 5.7 Google reCAPTCHA Tutorial with Example.In this post we will show you Laravel 5.7 – Google Recaptcha Code with Validation, hear for PHP Laravel 5.7 Contact Form With Validation And Recaptcha we will give you demo and example for implement.In this post, we will learn about Laravel 5.7 Validate Form on Submit using Google NoCaptcha reCaptcha with an example.

Laravel 5.7 Google reCAPTCHA Tutorial with Example

There are the Following The simple About Laravel 5.7 Google reCAPTCHA Tutorial with Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop Using new Google reCAPTCHA with PHP Laravel 5.7, so the How to Use reCAPTCHA in Laravel 5.7 Forms For Validation for this example is following below.

Step 1 : Install Laravel 5.7 Project

simple Laravel 5.7 version Web application

composer create-project --prefer-dist laravel/laravel atmiya25

Step 2: Install Latest anhskohbo/no-captcha Laravel Package

composer require anhskohbo/no-captcha

config/app.php

 [

         ///some providers in Laravel.....

         Anhskohbo\NoCaptcha\NoCaptchaServiceProvider::class

     ],

     'aliases' => [

         ////........some aliases

         'NoCaptcha' => Anhskohbo\NoCaptcha\Facades\NoCaptcha::class,

     ]

  ]

Step 3: Update Your Domain or Localhost in Google API Key

In this phase I simple need to set your google recaptcha-response site key as well as secret key. If you any don’t have your google-recaptcha-response site key as well as secret key then We can first of all click to create from here. So We First click on this google link : laravel 5.7 google captcha Admin Panel

setting of the .env Files

Laravel 5.7 Google reCAPTCHA GET KEY Tutorial with Example

NOCAPTCHA_SITEKEY=[google_captcha_site-key]
NOCAPTCHA_SECRET=[google_captcha_secret-key]

Step 4: Define Laravel Route

routes/web.php

Route::get('member-reg', 'MemberAuthController@MemberRegister');
Route::post('member-reg', 'MemberAuthController@memberAddArticle');

Step 5: Create Laravel MemberAuthController

app/Http/Controllers/MemberAuthController.php

validate($request, [
            'name' => 'required',
            'email' => 'required|email',
            'password' => 'required|same:member_pass_repeat',
            'member_pass_repeat' => 'required',
            'g-recaptcha-response' => 'required|captcha',
        ]);
   
        print('done');
    }
}

Step 6: Create Laravel Blade View File

resources/views/MemberRegister.blade.php




	Laravel 5.7 - Google Recaptcha Code with Validation - pakainfo.com
	
	
	 {!! NoCaptcha::renderJs() !!}


  

Laravel 5.7 - Google Recaptcha Code with Validation - Pakainfo.com

Sign Up - pakainfo.com
{!! csrf_field() !!}
has('name') ? ' has-error' : '' }}">
@if ($errors->has('name')) {{ $errors->first('name') }} @endif
has('email') ? ' has-error' : '' }}">
@if ($errors->has('email')) {{ $errors->first('email') }} @endif
has('password') ? ' has-error' : '' }}">
@if ($errors->has('password')) {{ $errors->first('password') }} @endif
has('member_pass_repeat') ? ' has-error' : '' }}">
@if ($errors->has('member_pass_repeat')) {{ $errors->first('member_pass_repeat') }} @endif
has('g-recaptcha-response') ? ' has-error' : '' }}">
{!! app('captcha')->display() !!} @if ($errors->has('g-recaptcha-response')) {{ $errors->first('g-recaptcha-response') }} @endif

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 Google reCAPTCHA Tutorial with Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment