diff --git a/docs/Writerside/hi.tree b/docs/Writerside/hi.tree index 0b33cec..208af31 100644 --- a/docs/Writerside/hi.tree +++ b/docs/Writerside/hi.tree @@ -3,16 +3,17 @@ SYSTEM "https://resources.jetbrains.com/writerside/1.0/product-profile.dtd"> + name="Netflex Toolbox" + start-page="Default-topic.md"> - - + + + - - + + \ No newline at end of file diff --git a/docs/Writerside/topics/recaptcha.md b/docs/Writerside/topics/recaptcha.md new file mode 100644 index 0000000..ced4621 --- /dev/null +++ b/docs/Writerside/topics/recaptcha.md @@ -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` diff --git a/src/Providers/ToolboxProvider.php b/src/Providers/ToolboxProvider.php index 329dba6..1d23007 100644 --- a/src/Providers/ToolboxProvider.php +++ b/src/Providers/ToolboxProvider.php @@ -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 { @@ -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(