Skip to content

Commit

Permalink
Merge pull request #58 from mattmcdonald-uk/master
Browse files Browse the repository at this point in the history
Laravel 7 support
  • Loading branch information
msurguy committed Mar 9, 2020
2 parents 16bba32 + d05bf81 commit ac8c28d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
],
"require": {
"php": ">=5.3.0",
"illuminate/support": "4.*|5.*|6.*",
"illuminate/config": "4.*|5.*|6.*",
"illuminate/translation": "4.*|5.*|6.*"
"illuminate/support": "4.*|5.*|6.*|7.*",
"illuminate/config": "4.*|5.*|6.*|7.*",
"illuminate/translation": "4.*|5.*|6.*|7.*"
},
"require-dev": {
"phpunit/phpunit": "4.0.*",
Expand Down
14 changes: 7 additions & 7 deletions src/Msurguy/Honeypot/HoneypotServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ public function register()
*/
public function boot()
{
if ($this->isLaravelVersion('4')) {
$this->package('msurguy/honeypot');
} elseif ($this->isLaravelVersion('5') || $this->isLaravelVersion('6')) {
if ($this->isLaravelMinimumVersion(5)) {
$this->loadTranslationsFrom(__DIR__ . '/../../lang', 'honeypot');
} else {
$this->package('msurguy/honeypot');
}

$this->app->booted(function ($app) {
Expand All @@ -62,13 +62,13 @@ public function provides()
}

/**
* Determine if laravel starts with any of the given version strings
* Determine if Laravel version is at least the given version.
*
* @param string|array $startsWith
* @param string|array $minimumVersion
* @return boolean
*/
protected function isLaravelVersion($startsWith)
protected function isLaravelMinimumVersion($minimumVersion)
{
return Str::startsWith(Application::VERSION, $startsWith);
return (float)Application::VERSION >= $minimumVersion;
}
}

0 comments on commit ac8c28d

Please sign in to comment.