Skip to content

Commit

Permalink
Laravel 6 (#14)
Browse files Browse the repository at this point in the history
* laravel 6 support
* cache clear on new badge generation
  • Loading branch information
saqueib authored Sep 5, 2019
1 parent 7220abf commit 44cc515
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 7.1
- 7.2
- 7.3

before_script:
- travis_retry composer self-update
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

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

## 1.0.3 - 2019-09-05

- Laravel 6 support

## 1.0.2 - 2019-03-17

- Added subject relation on a reputation

## 1.0.1 - 2019-03-12

- Added Laravel 5.8 compatibility

## 1.0.0 - 2018-11-29

- initial release
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
}
],
"require": {
"php": ">=7.1",
"laravel/framework": "~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0"
"php": ">=7.2",
"laravel/framework": "~5.4.0|~5.5.0|~5.6.0|~5.7.0|~5.8.0|^6.0"
},
"require-dev": {
"orchestra/testbench": "~3.8",
"orchestra/testbench": "~3.8|^4.0",
"mockery/mockery": "^0.9.4 || ~1.0",
"phpunit/phpunit": "~7.0"
"phpunit/phpunit": "~8.0"
},
"autoload": {
"psr-4": {
Expand Down
8 changes: 5 additions & 3 deletions src/BadgeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace QCod\Gamify;

use Illuminate\Support\Str;
use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;

abstract class BadgeType
Expand Down Expand Up @@ -78,7 +80,7 @@ public function getLevel()
return $level;
}

return array_get(
return Arr::get(
config('gamify.badge_levels', []),
$level,
config('gamify.badge_default_level', 1)
Expand All @@ -102,7 +104,7 @@ public function getBadgeId()
*/
protected function getDefaultBadgeName()
{
return ucwords(snake_case(class_basename($this), ' '));
return ucwords(Str::snake(class_basename($this), ' '));
}

/**
Expand All @@ -115,7 +117,7 @@ protected function getDefaultIcon()
return sprintf(
'%s/%s%s',
rtrim(config('gamify.badge_icon_folder', 'images/badges'), '/'),
kebab_case(class_basename($this)),
Str::kebab(class_basename($this)),
config('gamify.badge_icon_extension', '.svg')
);
}
Expand Down
16 changes: 16 additions & 0 deletions src/Console/MakeBadgeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,20 @@ protected function getDefaultNamespace($rootNamespace)
{
return $rootNamespace.'\Gamify\Badges';
}

/**
* Execute the console command.
*
* @return bool|null
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function handle()
{
// clear the cache for badges
cache()->forget('gamify.badges.all');

return parent::handle();
}


}

0 comments on commit 44cc515

Please sign in to comment.