Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit bf62b19

Browse files
committed
Load routes in ReCaptchaServiceProvider::registerRoutes method
1 parent a7f86d3 commit bf62b19

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

src/ReCaptchaServiceProvider.php

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
namespace Biscolab\ReCaptcha;
1212

13+
use Illuminate\Support\Facades\Route;
1314
use Illuminate\Support\ServiceProvider;
1415
use Validator;
1516

@@ -32,8 +33,8 @@ class ReCaptchaServiceProvider extends ServiceProvider {
3233
public function boot() {
3334

3435
$this->addValidationRule();
35-
$this->loadRoutesFrom(__DIR__ . '/routes/routes.php');
36-
36+
// $this->loadRoutesFrom(__DIR__ . '/routes/routes.php');
37+
$this->registerRoutes();
3738
$this->publishes([
3839
__DIR__ . '/../config/recaptcha.php' => config_path('recaptcha.php'),
3940
]);
@@ -65,6 +66,29 @@ public function register() {
6566
$this->registerReCaptchaBuilder();
6667
}
6768

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+
6892
/**
6993
* Register the HTML builder instance.
7094
*
@@ -93,14 +117,4 @@ protected function registerReCaptchaBuilder() {
93117
});
94118
}
95119

96-
/**
97-
* Get the services provided by the provider.
98-
*
99-
* @return array
100-
*/
101-
public function provides() {
102-
103-
return ['recaptcha'];
104-
}
105-
106120
}

src/routes/.gitkeep

Whitespace-only changes.

src/routes/routes.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)