@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | // $this->loadRoutesFrom(__DIR__ . '/routes/routes.php'); |
37 | 37 | $this->registerRoutes(); |
38 | 38 | $this->publishes([ |
39 | - __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'), |
|
39 | + __DIR__.'/../config/recaptcha.php' => config_path('recaptcha.php'), |
|
40 | 40 | ]); |
41 | 41 | |
42 | 42 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function addValidationRule() { |
48 | 48 | |
49 | - Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) { |
|
49 | + Validator::extendImplicit('recaptcha', function($attribute, $value, $parameters, $validator) { |
|
50 | 50 | |
51 | 51 | return app('recaptcha')->validate($value); |
52 | 52 | }, trans('validation.recaptcha')); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function register() { |
61 | 61 | |
62 | 62 | $this->mergeConfigFrom( |
63 | - __DIR__ . '/../config/recaptcha.php', 'recaptcha' |
|
63 | + __DIR__.'/../config/recaptcha.php', 'recaptcha' |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->registerReCaptchaBuilder(); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function registerReCaptchaBuilder() { |
98 | 98 | |
99 | - $this->app->singleton('recaptcha', function ($app) { |
|
99 | + $this->app->singleton('recaptcha', function($app) { |
|
100 | 100 | |
101 | 101 | $recaptcha_class = ''; |
102 | 102 |
@@ -20,103 +20,103 @@ |
||
20 | 20 | */ |
21 | 21 | class ReCaptchaServiceProvider extends ServiceProvider { |
22 | 22 | |
23 | - /** |
|
24 | - * Indicates if loading of the provider is deferred. |
|
25 | - * |
|
26 | - * @var bool |
|
27 | - */ |
|
28 | - protected $defer = false; |
|
29 | - |
|
30 | - /** |
|
31 | - * |
|
32 | - */ |
|
33 | - public function boot() { |
|
34 | - |
|
35 | - $this->addValidationRule(); |
|
23 | + /** |
|
24 | + * Indicates if loading of the provider is deferred. |
|
25 | + * |
|
26 | + * @var bool |
|
27 | + */ |
|
28 | + protected $defer = false; |
|
29 | + |
|
30 | + /** |
|
31 | + * |
|
32 | + */ |
|
33 | + public function boot() { |
|
34 | + |
|
35 | + $this->addValidationRule(); |
|
36 | 36 | // $this->loadRoutesFrom(__DIR__ . '/routes/routes.php'); |
37 | - $this->registerRoutes(); |
|
38 | - $this->publishes([ |
|
39 | - __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'), |
|
40 | - ]); |
|
41 | - |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Extends Validator to include a recaptcha type |
|
46 | - */ |
|
47 | - public function addValidationRule() { |
|
48 | - |
|
49 | - Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) { |
|
50 | - |
|
51 | - return app('recaptcha')->validate($value); |
|
52 | - }, trans('validation.recaptcha')); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Register the service provider. |
|
57 | - * |
|
58 | - * @return void |
|
59 | - */ |
|
60 | - public function register() { |
|
61 | - |
|
62 | - $this->mergeConfigFrom( |
|
63 | - __DIR__ . '/../config/recaptcha.php', 'recaptcha' |
|
64 | - ); |
|
65 | - |
|
66 | - $this->registerReCaptchaBuilder(); |
|
67 | - } |
|
68 | - |
|
69 | - /** |
|
70 | - * Get the services provided by the provider. |
|
71 | - * |
|
72 | - * @return array |
|
73 | - */ |
|
74 | - public function provides(): array { |
|
75 | - |
|
76 | - return ['recaptcha']; |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * @return ReCaptchaServiceProvider |
|
81 | - * |
|
82 | - * @since v3.4.1 |
|
83 | - */ |
|
84 | - protected function registerRoutes(): ReCaptchaServiceProvider { |
|
85 | - |
|
86 | - Route::get( |
|
87 | - config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'), |
|
88 | - ['uses' => 'Biscolab\ReCaptcha\Controllers\ReCaptchaController@validateV3'] |
|
89 | - )->middleware('web'); |
|
90 | - |
|
91 | - return $this; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Register the HTML builder instance. |
|
96 | - * |
|
97 | - * @return void |
|
98 | - */ |
|
99 | - protected function registerReCaptchaBuilder() { |
|
100 | - |
|
101 | - $this->app->singleton('recaptcha', function ($app) { |
|
102 | - |
|
103 | - $recaptcha_class = ''; |
|
104 | - |
|
105 | - switch (config('recaptcha.version')) { |
|
106 | - case 'v3' : |
|
107 | - $recaptcha_class = ReCaptchaBuilderV3::class; |
|
108 | - break; |
|
109 | - case 'v2' : |
|
110 | - $recaptcha_class = ReCaptchaBuilderV2::class; |
|
111 | - break; |
|
112 | - case 'invisible': |
|
113 | - $recaptcha_class = ReCaptchaBuilderInvisible::class; |
|
114 | - break; |
|
115 | - } |
|
116 | - |
|
117 | - return new $recaptcha_class(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key')); |
|
118 | - |
|
119 | - }); |
|
120 | - } |
|
37 | + $this->registerRoutes(); |
|
38 | + $this->publishes([ |
|
39 | + __DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'), |
|
40 | + ]); |
|
41 | + |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Extends Validator to include a recaptcha type |
|
46 | + */ |
|
47 | + public function addValidationRule() { |
|
48 | + |
|
49 | + Validator::extendImplicit('recaptcha', function ($attribute, $value, $parameters, $validator) { |
|
50 | + |
|
51 | + return app('recaptcha')->validate($value); |
|
52 | + }, trans('validation.recaptcha')); |
|
53 | + } |
|
54 | + |
|
55 | + /** |
|
56 | + * Register the service provider. |
|
57 | + * |
|
58 | + * @return void |
|
59 | + */ |
|
60 | + public function register() { |
|
61 | + |
|
62 | + $this->mergeConfigFrom( |
|
63 | + __DIR__ . '/../config/recaptcha.php', 'recaptcha' |
|
64 | + ); |
|
65 | + |
|
66 | + $this->registerReCaptchaBuilder(); |
|
67 | + } |
|
68 | + |
|
69 | + /** |
|
70 | + * Get the services provided by the provider. |
|
71 | + * |
|
72 | + * @return array |
|
73 | + */ |
|
74 | + public function provides(): array { |
|
75 | + |
|
76 | + return ['recaptcha']; |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * @return ReCaptchaServiceProvider |
|
81 | + * |
|
82 | + * @since v3.4.1 |
|
83 | + */ |
|
84 | + protected function registerRoutes(): ReCaptchaServiceProvider { |
|
85 | + |
|
86 | + Route::get( |
|
87 | + config('recaptcha.default_validation_route', 'biscolab-recaptcha/validate'), |
|
88 | + ['uses' => 'Biscolab\ReCaptcha\Controllers\ReCaptchaController@validateV3'] |
|
89 | + )->middleware('web'); |
|
90 | + |
|
91 | + return $this; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Register the HTML builder instance. |
|
96 | + * |
|
97 | + * @return void |
|
98 | + */ |
|
99 | + protected function registerReCaptchaBuilder() { |
|
100 | + |
|
101 | + $this->app->singleton('recaptcha', function ($app) { |
|
102 | + |
|
103 | + $recaptcha_class = ''; |
|
104 | + |
|
105 | + switch (config('recaptcha.version')) { |
|
106 | + case 'v3' : |
|
107 | + $recaptcha_class = ReCaptchaBuilderV3::class; |
|
108 | + break; |
|
109 | + case 'v2' : |
|
110 | + $recaptcha_class = ReCaptchaBuilderV2::class; |
|
111 | + break; |
|
112 | + case 'invisible': |
|
113 | + $recaptcha_class = ReCaptchaBuilderInvisible::class; |
|
114 | + break; |
|
115 | + } |
|
116 | + |
|
117 | + return new $recaptcha_class(config('recaptcha.api_site_key'), config('recaptcha.api_secret_key')); |
|
118 | + |
|
119 | + }); |
|
120 | + } |
|
121 | 121 | |
122 | 122 | } |