Skip to content

Commit

Permalink
Merge pull request #56 from jdanino/master
Browse files Browse the repository at this point in the history
Update for Laravel 6 compatibility
  • Loading branch information
msurguy authored Sep 6, 2019
2 parents d2f24fb + aa05f94 commit 6a56b99
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Msurguy/Honeypot/HoneypotServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;

class HoneypotServiceProvider extends ServiceProvider {
class HoneypotServiceProvider extends ServiceProvider
{

/**
* Indicates if loading of the provider is deferred.
Expand All @@ -20,8 +21,7 @@ class HoneypotServiceProvider extends ServiceProvider {
*/
public function register()
{
$this->app->singleton('honeypot', function($app)
{
$this->app->singleton('honeypot', function ($app) {
return new Honeypot;
});
}
Expand All @@ -33,16 +33,13 @@ public function register()
*/
public function boot()
{
if ($this->isLaravelVersion('4'))
{
if ($this->isLaravelVersion('4')) {
$this->package('msurguy/honeypot');
}
elseif ($this->isLaravelVersion('5'))
{
} elseif ($this->isLaravelVersion('5') || $this->isLaravelVersion('6')) {
$this->loadTranslationsFrom(__DIR__ . '/../../lang', 'honeypot');
}

$this->app->booted(function($app) {
$this->app->booted(function ($app) {

// Get validator and translator
$validator = $app['validator'];
Expand All @@ -51,7 +48,6 @@ public function boot()
// Add honeypot and honeytime custom validation rules
$validator->extend('honeypot', 'honeypot@validateHoneypot', $translator->get('honeypot::validation.honeypot'));
$validator->extend('honeytime', 'honeypot@validateHoneytime', $translator->get('honeypot::validation.honeytime'));

});
}

Expand Down

0 comments on commit 6a56b99

Please sign in to comment.