Skip to content

Commit bc61105

Browse files
Merge pull request dingo#1637 from specialtactics/bugfix/update-to-use-laravel-5.8-cache-ttl
Use Cache TTLs using now() - Laravel 5.8 compatibility
2 parents 57d36bb + 9819c4a commit bc61105

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

composer.json

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,25 @@
1313
"email": "[email protected]"
1414
}],
1515
"require": {
16-
"php": "^7.0",
16+
"php": "^7.1",
1717
"dingo/blueprint": "^0.2",
18-
"illuminate/routing": "^5.1",
19-
"illuminate/support": "^5.1",
20-
"league/fractal": "^0.17"
18+
"illuminate/routing": "^5.5",
19+
"illuminate/support": "^5.5",
20+
"league/fractal": "^0.17",
21+
"laravel/framework": "^5.5"
2122
},
2223
"require-dev": {
2324
"phpdocumentor/reflection-docblock": "3.3.2",
2425
"friendsofphp/php-cs-fixer": "~2",
25-
"illuminate/auth": "^5.1",
26-
"illuminate/cache": "^5.1",
27-
"illuminate/console": "^5.1",
28-
"illuminate/database": "^5.1",
29-
"illuminate/events": "^5.1",
30-
"illuminate/filesystem": "^5.1",
31-
"illuminate/log": "^5.1",
32-
"illuminate/pagination": "^5.1",
33-
"laravel/lumen-framework": "^5.1",
26+
"illuminate/auth": "^5.5",
27+
"illuminate/cache": "^5.5",
28+
"illuminate/console": "^5.5",
29+
"illuminate/database": "^5.5",
30+
"illuminate/events": "^5.5",
31+
"illuminate/filesystem": "^5.5",
32+
"illuminate/log": "^5.5",
33+
"illuminate/pagination": "^5.5",
34+
"laravel/lumen-framework": "^5.5",
3435
"mockery/mockery": "~1.0",
3536
"phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.5",
3637
"squizlabs/php_codesniffer": "~2.0",

src/Http/RateLimit/Handler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ protected function key($key)
185185
*/
186186
protected function cache($key, $value, $minutes)
187187
{
188-
$this->cache->add($this->key($key), $value, $minutes);
188+
$this->cache->add($this->key($key), $value, now()->addMinutes($minutes));
189189
}
190190

191191
/**

tests/ChecksLaravelVersionTrait.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,15 @@ private function getApplicationStub()
3232
if ('dev-master' === $version) {
3333
$version = $this->current_release;
3434
}
35-
$compared_versions = version_compare('5.8', $version);
36-
// If comparison is Less Than, or Equal To, provide the 5.8 stub.
37-
if ($compared_versions === -1 || $compared_versions === 0) {
35+
36+
// Remove the 'v' in for example 'v5.8.3'
37+
$version = str_replace('v', '', $version);
38+
39+
// Return the version stub for the right version
40+
if (version_compare($version, '5.8.0', '>=')) {
3841
return new Application58Stub;
42+
} else {
43+
return new ApplicationStub;
3944
}
40-
41-
return new ApplicationStub;
4245
}
4346
}

0 commit comments

Comments
 (0)