10
10
11
11
namespace Biscolab \ReCaptcha ;
12
12
13
+ use Illuminate \Support \Facades \Route ;
13
14
use Illuminate \Support \ServiceProvider ;
14
15
use Validator ;
15
16
@@ -32,8 +33,8 @@ class ReCaptchaServiceProvider extends ServiceProvider {
32
33
public function boot () {
33
34
34
35
$ this ->addValidationRule ();
35
- $ this ->loadRoutesFrom (__DIR__ . '/routes/routes.php ' );
36
-
36
+ // $this->loadRoutesFrom(__DIR__ . '/routes/routes.php');
37
+ $ this -> registerRoutes ();
37
38
$ this ->publishes ([
38
39
__DIR__ . '/../config/recaptcha.php ' => config_path ('recaptcha.php ' ),
39
40
]);
@@ -65,6 +66,29 @@ public function register() {
65
66
$ this ->registerReCaptchaBuilder ();
66
67
}
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
+ protected function registerRoutes (): ReCaptchaServiceProvider {
83
+
84
+ Route::get (
85
+ config ('recaptcha.default_validation_route ' , 'biscolab-recaptcha/validate ' ),
86
+ ['uses ' => 'Biscolab\ReCaptcha\Controllers\ReCaptchaController@validateV3 ' ]
87
+ )->middleware ('web ' );
88
+
89
+ return $ this ;
90
+ }
91
+
68
92
/**
69
93
* Register the HTML builder instance.
70
94
*
@@ -93,14 +117,4 @@ protected function registerReCaptchaBuilder() {
93
117
});
94
118
}
95
119
96
- /**
97
- * Get the services provided by the provider.
98
- *
99
- * @return array
100
- */
101
- public function provides () {
102
-
103
- return ['recaptcha ' ];
104
- }
105
-
106
120
}
0 commit comments