Skip to content

Commit 6a56b99

Browse files
authored
Merge pull request #56 from jdanino/master
Update for Laravel 6 compatibility
2 parents d2f24fb + aa05f94 commit 6a56b99

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/Msurguy/Honeypot/HoneypotServiceProvider.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
use Illuminate\Support\ServiceProvider;
55
use Illuminate\Support\Str;
66

7-
class HoneypotServiceProvider extends ServiceProvider {
7+
class HoneypotServiceProvider extends ServiceProvider
8+
{
89

910
/**
1011
* Indicates if loading of the provider is deferred.
@@ -20,8 +21,7 @@ class HoneypotServiceProvider extends ServiceProvider {
2021
*/
2122
public function register()
2223
{
23-
$this->app->singleton('honeypot', function($app)
24-
{
24+
$this->app->singleton('honeypot', function ($app) {
2525
return new Honeypot;
2626
});
2727
}
@@ -33,16 +33,13 @@ public function register()
3333
*/
3434
public function boot()
3535
{
36-
if ($this->isLaravelVersion('4'))
37-
{
36+
if ($this->isLaravelVersion('4')) {
3837
$this->package('msurguy/honeypot');
39-
}
40-
elseif ($this->isLaravelVersion('5'))
41-
{
38+
} elseif ($this->isLaravelVersion('5') || $this->isLaravelVersion('6')) {
4239
$this->loadTranslationsFrom(__DIR__ . '/../../lang', 'honeypot');
4340
}
4441

45-
$this->app->booted(function($app) {
42+
$this->app->booted(function ($app) {
4643

4744
// Get validator and translator
4845
$validator = $app['validator'];
@@ -51,7 +48,6 @@ public function boot()
5148
// Add honeypot and honeytime custom validation rules
5249
$validator->extend('honeypot', 'honeypot@validateHoneypot', $translator->get('honeypot::validation.honeypot'));
5350
$validator->extend('honeytime', 'honeypot@validateHoneytime', $translator->get('honeypot::validation.honeytime'));
54-
5551
});
5652
}
5753

0 commit comments

Comments
 (0)