Skip to content

Commit 44cc515

Browse files
authored
Laravel 6 (#14)
* laravel 6 support * cache clear on new badge generation
1 parent 7220abf commit 44cc515

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: php
22

33
php:
4-
- 7.1
54
- 7.2
5+
- 7.3
66

77
before_script:
88
- travis_retry composer self-update

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to `qcod/laravel-gamify` will be documented in this file
44

5+
## 1.0.3 - 2019-09-05
6+
7+
- Laravel 6 support
8+
9+
## 1.0.2 - 2019-03-17
10+
11+
- Added subject relation on a reputation
12+
13+
## 1.0.1 - 2019-03-12
14+
15+
- Added Laravel 5.8 compatibility
16+
517
## 1.0.0 - 2018-11-29
618

719
- initial release

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
}
2323
],
2424
"require": {
25-
"php": ">=7.1",
26-
"laravel/framework": "~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0"
25+
"php": ">=7.2",
26+
"laravel/framework": "~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0"
2727
},
2828
"require-dev": {
29-
"orchestra/testbench": "~3.8",
29+
"orchestra/testbench": "~3.8|^4.0",
3030
"mockery/mockery": "^0.9.4 || ~1.0",
31-
"phpunit/phpunit": "~7.0"
31+
"phpunit/phpunit": "~8.0"
3232
},
3333
"autoload": {
3434
"psr-4": {

src/BadgeType.php

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace QCod\Gamify;
44

5+
use Illuminate\Support\Str;
6+
use Illuminate\Support\Arr;
57
use Illuminate\Database\Eloquent\Model;
68

79
abstract class BadgeType
@@ -78,7 +80,7 @@ public function getLevel()
7880
return $level;
7981
}
8082

81-
return array_get(
83+
return Arr::get(
8284
config('gamify.badge_levels', []),
8385
$level,
8486
config('gamify.badge_default_level', 1)
@@ -102,7 +104,7 @@ public function getBadgeId()
102104
*/
103105
protected function getDefaultBadgeName()
104106
{
105-
return ucwords(snake_case(class_basename($this), ' '));
107+
return ucwords(Str::snake(class_basename($this), ' '));
106108
}
107109

108110
/**
@@ -115,7 +117,7 @@ protected function getDefaultIcon()
115117
return sprintf(
116118
'%s/%s%s',
117119
rtrim(config('gamify.badge_icon_folder', 'images/badges'), '/'),
118-
kebab_case(class_basename($this)),
120+
Str::kebab(class_basename($this)),
119121
config('gamify.badge_icon_extension', '.svg')
120122
);
121123
}

src/Console/MakeBadgeCommand.php

+16
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,20 @@ protected function getDefaultNamespace($rootNamespace)
4848
{
4949
return $rootNamespace.'\Gamify\Badges';
5050
}
51+
52+
/**
53+
* Execute the console command.
54+
*
55+
* @return bool|null
56+
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
57+
*/
58+
public function handle()
59+
{
60+
// clear the cache for badges
61+
cache()->forget('gamify.badges.all');
62+
63+
return parent::handle();
64+
}
65+
66+
5167
}

0 commit comments

Comments
 (0)