Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New way of badge added #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

New way of badge added #17

wants to merge 4 commits into from

Conversation

Lastwisher
Copy link

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.

@Lastwisher Lastwisher mentioned this pull request Oct 14, 2019
@Devsome
Copy link

Devsome commented Nov 4, 2019

@saqueib what about this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants