Skip to content

Commit

Permalink
Add recaptcha config
Browse files Browse the repository at this point in the history
  • Loading branch information
tommysolsen committed Nov 13, 2023
1 parent 681f133 commit 071bef3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
13 changes: 7 additions & 6 deletions docs/Writerside/hi.tree
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd">

<instance-profile id="hi"
name="Netflex Toolbox"
start-page="Default-topic.md">
name="Netflex Toolbox"
start-page="Default-topic.md">

<toc-element topic="Default-topic.md"/>
<toc-element topic="trailing-slashes.md" />
<toc-element id="I18n" topic="i18n.md" />
<toc-element topic="trailing-slashes.md"/>
<toc-element id="I18n" topic="i18n.md"/>
<toc-element id="Recaptcha" topic="recaptcha.md"/>


<toc-element id="commands" topic="commands.md">
<toc-element id="orders" topic="orders.md" />
<toc-element id="index" topic="indexing.md" />
<toc-element id="orders" topic="orders.md"/>
<toc-element id="index" topic="indexing.md"/>
</toc-element>
</instance-profile>
10 changes: 10 additions & 0 deletions docs/Writerside/topics/recaptcha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Google Recaptcha

## Validation rule

The toolbox also adds a Recaptcha validator for use with requests. The toolbox adds the `recaptcha-v2`, validation rule.

## Configuration

You can publish the configuration to set the site and private key. Using vendor
publish. `php artisan vendor:publish --tag=toolbox-recaptcha-v2-config`
4 changes: 4 additions & 0 deletions src/Providers/ToolboxProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
namespace Netflex\Toolbox\Providers;

use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\View;
use Netflex\Toolbox\Middleware\AddTrailingSlash;
use Netflex\Toolbox\Middleware\RemoveTrailingSlash;
use Netflex\Toolbox\Validations\RecaptchaV2;

class ToolboxProvider extends \Illuminate\Support\ServiceProvider
{
Expand Down Expand Up @@ -50,6 +52,8 @@ public function bootRecaptcha(): void
{
Blade::componentNamespace('Netflex\\Toolbox\\Views\\Components', 'toolbox');
View::addNamespace('toolbox', __DIR__ . "/../../views");
Validator::extend('recaptcha-v2', RecaptchaV2::class);

$this->mergeConfigFrom(__DIR__ . "/../../config/recaptcha-v2.php", "recaptcha-v2");

$this->publishes(
Expand Down

0 comments on commit 071bef3

Please sign in to comment.