Skip to content

Commit

Permalink
Merge pull request #82 from ARCANEDEV/patch-1
Browse files Browse the repository at this point in the history
Fixing & cleaning
  • Loading branch information
arcanedev-maroc committed Feb 4, 2019
2 parents 63947ca + f66e7ce commit cbef775
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
12 changes: 6 additions & 6 deletions _docs/3-Usage.md
Expand Up @@ -139,9 +139,9 @@ if ($_POST) {
<?php echo $captcha->script(); ?>

<script>
grecaptcha.ready(function() {
grecaptcha.execute('SITE-KEY', {action: 'homepage'});
});
grecaptcha.ready(function() {
grecaptcha.execute('SITE-KEY', {action: 'homepage'});
});
</script>
```

Expand All @@ -156,7 +156,7 @@ Insert reCAPTCHA inside your form using one of this examples:
```php
{!! Form::open([...]) !!}
// Other inputs...
{!! Form::captcha() !!} OR {!! Captcha::display() !!}
{!! Form::captcha() !!} OR {!! no_captcha()->display() !!}
{!! Form::submit('Submit') !!}
{!! Form::close() !!}

Expand All @@ -173,13 +173,13 @@ Insert reCAPTCHA inside your form using one of this examples:

echo Form::open([...]);
// Other inputs...
echo Form::captcha();
echo no_captcha()->display()->toHtml();
echo Form::submit('Submit');
echo Form::close();

?>

<?php echo Captcha::script(); ?>
<?php echo no_captcha()->script()->toHtml(); ?>
```

#### Back-end (Controller or somewhere in your project ...)
Expand Down
2 changes: 1 addition & 1 deletion helpers.php
Expand Up @@ -3,7 +3,7 @@
use Arcanedev\NoCaptcha\Contracts\NoCaptcha;
use Arcanedev\NoCaptcha\Contracts\NoCaptchaManager;

if ( ! function_exists('nocaptcha')) {
if ( ! function_exists('no_captcha')) {
/**
* Get the NoCaptcha builder.
*
Expand Down
15 changes: 6 additions & 9 deletions src/NoCaptchaServiceProvider.php
Expand Up @@ -2,6 +2,7 @@

use Arcanedev\LaravelHtml\Contracts\FormBuilder;
use Arcanedev\Support\PackageServiceProvider as ServiceProvider;
use Illuminate\Contracts\Foundation\Application;

/**
* Class NoCaptchaServiceProvider
Expand Down Expand Up @@ -69,19 +70,15 @@ public function provides()

private function registerNoCaptchaManager()
{
$this->bind(Contracts\NoCaptchaManager::class, function ($app) {
$this->singleton(Contracts\NoCaptchaManager::class, function ($app) {
return new NoCaptchaManager($app);
});

$this->bind(Contracts\NoCaptcha::class, function ($app) {
/**
* @var \Illuminate\Contracts\Config\Repository $config
* @var \Arcanedev\NoCaptcha\Contracts\NoCaptchaManager $manager
*/
$config = $app['config'];
$manager = $app[Contracts\NoCaptchaManager::class];
$this->bind(Contracts\NoCaptcha::class, function (Application $app) {
/** @var \Illuminate\Contracts\Config\Repository $config */
$config = $app['config'];

return $manager->version(
return $app->make(Contracts\NoCaptchaManager::class)->version(
$config->get('no-captcha.version')
);
});
Expand Down

0 comments on commit cbef775

Please sign in to comment.