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

Commit dd0d39d

Browse files
committed
Merge branch 'feature/register-routes-in-provider' into develop
2 parents a7f86d3 + eb56798 commit dd0d39d

File tree

3 files changed

+29
-27
lines changed

3 files changed

+29
-27
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Available reCAPTCHA versions:
1212
| Package version | PHP version | Laravel version |
1313
|-----------------|-------------|-----------------|
1414
| 3.x | 7.1 or greater | 5.5 or greater |
15-
| 2.x | 5.5.9|7.0 or greater | 5.0 or greater |
15+
| 2.x | 5.5.9, 7.0 or greater | 5.0 or greater |
1616

1717
Are you still using PHP 5.x or 7.0? Please go to [V2](https://github.com/biscolab/laravel-recaptcha/tree/v2.0.4)
1818

src/ReCaptchaServiceProvider.php

Lines changed: 28 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,31 @@ 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+
* @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+
6894
/**
6995
* Register the HTML builder instance.
7096
*
@@ -93,14 +119,4 @@ protected function registerReCaptchaBuilder() {
93119
});
94120
}
95121

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

src/routes/routes.php

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

0 commit comments

Comments
 (0)