vendredi 5 février 2016

Achievements/badge system… real life project (laravel 5.1)

I like to implement a badge-system on my own personal projects build with Laravel 5.1

It’s been days now I’m straggling with Achievements/badge system; I did a lot of searching, reading a lot of comments.

I’ve been reading some of the questions here about badge-systems

Best way to store Badge criteria?

How to design logic to store rules assigning badges and reputation points to site users

Why do sites like stackoverflow with badges use some type of delayed job to determine when to award a new badge?

designing a badge system, where to fire business logic? In code or stored procedures? or both?

Database Architecture for "Badge" System & Arbitrary Criteria (MySQL/PHP)

but I didn’t come up with real solution, it’s was mostly opinions

Here my approach to the badge system (database structure)

Users table

Id 
Name
Email
Password

User_statistics table

Id 
User_id
Posts (number of posts)
Score (points earned)

Badges table

Id
Name
Description
Image
Condition (criteria) (number of points to earn this badge ex : > 100 points)

Pivot table (users – badges) (many to many relationship)

Badge_user table

Id
User_id
Badge_id

First: is this the best approach to build a maintainable badge system

Second(logic) : the right queries or Events/Listeners to affect badges to users depends of the points earned (field points of user_statistics table)

your suggestions are very welcome



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire