Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a new way of badge works with levels, i changed almost everything here. Db didn't changed.
Code is very primitive im just making this pull request to see how do you guys feel about this change. If you like i would like to proper read me file and full documentation.
Main change is level system and qualification of badge,
Work flow of old system :
When user point is changed sync is working and scans all of badges and get sum of qualified ones and sync with database.
New work flow system :
Badges are given individually, they can go thru qualification and get proper level. Or you can force give badge to user. Also i added extra parameters to qualification. Sometimes we need more then just User model to see qualification. And qualify renamed to islevelArchived because this function now expect return level instead or bool.
Mainly i added proper level and description for all badge functions. Now badges are recorded as Badge + level per row.
I also removed sync function now Badges are recorded on construct. Each Badge have own cache key with tag. To remove cache
php artisan cache:clear --tags="laravel-gamify"
Also i moved event modules to config, This way users can override their Events, also Sync listener removed.
And there is 2 way to add badge :
giveBadge(new FirstContribution());
$user->giveBadge(new FirstContribution());
I hope you guys would like this PR, i will keep working to implement a basic level system.
Thanks.