Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Laravel 6 compatibility #56

Merged
merged 1 commit into from
Sep 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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