thinhbuzz / laravel-google-captcha

Google captcha for Laravel 5, Laravel 6, Laravel 7, Laravel 8, Laravel 9 and Laravel 10, support multiple captcha on page
MIT License
200 stars 32 forks source link

Having Trouble #8

Closed HDVinnie closed 7 years ago

HDVinnie commented 7 years ago

So I started off running composer require buzz/laravel-google-captcha install went fine.

Im running laravel 5.4

Add ServiceProvider to the providers array in app/config/app.php. 'Buzz\LaravelGoogleCaptcha\CaptchaServiceProvider', (seeing im 5.4 and this doesnt exist I did the following)

Add ServiceProvider to the providers array in config/app.php. Buzz\LaravelGoogleCaptcha\CaptchaServiceProvider::class,

Then use Facade: add 'Captcha' => '\Buzz\LaravelGoogleCaptcha\CaptchaFacade', to the aliases array in app/config/app.php (seeing im 5.4 and this doesnt exist I did the following)

Facade: add 'Captcha' => \Buzz\LaravelGoogleCaptcha\CaptchaFacade::class, to the aliases array in config/app.php

Then added my CAPTCHA_SECRET=[secret-key] CAPTCHA_SITEKEY=[site-key] with proper keys to my .env

Then placed {!! Captcha::display($attributes) !!} in my login.blade.php

When I goto login page I get the following error: Undefined variable: attributes (View: /home/UNIT3D_2.0/resources/views/user/login.blade.php)

thinhbuzz commented 7 years ago

Please read it: How to use it:

With

$attributes = [
  'data-theme' => 'dark',
  'data-type' =>  'audio',
];

More infomation on google recaptcha document

It mean:

{!! Captcha::display( [
    'data-theme' => 'dark',
    'data-type' =>  'audio',
]) !!}
HDVinnie commented 7 years ago

I see I assumed {!! Captcha::display($attributes) !!} would have a default value of the light theme. and would use something like {!! Captcha::display( ['data-theme' => 'dark',]) !!} if you wanted to use dark theme instead