The Course Portal Achievements System is a feature within our course portal platform that enhances the user experience by allowing users to unlock achievements and earn badges based on their interactions with the platform. This README provides an overview of the functionality and concepts behind this system.
git clone https://github.com/miladesmailpour/developer-test.git
git clone git@github.com:miladesmailpour/developer-test.git
composer install
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD= password \\Repalce With your password
php artisan migrate
php artisan db:seed
php artisan serve
The Achievements System is event-driven. It listens for specific user events and triggers the unlocking of achievements and badges accordingly. The two main events are:
LessonWatched
: Fired when a user watches a lesson.CommentWritten
: Fired when a user writes a comment.AchievementUnlockEvent
: Fired when a Achievement Unlock "comment or lesson".BadgeUnlockedEvent
: Fired when a Badge Unlocked.LevelUpAchievements
: Listen to New Achievement Unlock "comment or lesson".NewBadgeAchieved
: Listen to New Badge Unlock.NewCommentAdded
: Listen to New Comment adedd.NewLessonWatched
: Listen to New Lesson Watched.Achievements
Comment
Lesson
User
UserAchievementsBadge
CommentController
LessonController
UserController
/register
/login
/comment
/lesson
/user/comments
/user/lessons
The system provides an API endpoint to retrieve information about a user's achievements. The endpoint, users/{user}/achievements
, returns the following:
unlocked_achievements
: An array of the user's unlocked achievements by name.next_available_achievements
: An array of the next achievements the user can unlock by name.current_badge
: The name of the user's current badge.next_badge
: The name of the next badge the user can earn.remaining_to_unlock_next_badge
: The number of additional achievements the user must unlock to earn the next badge.The Achievements System follows an event-driven architecture. It listens for user events and reacts to them by unlocking achievements and badges. This decoupled approach allows for flexibility and scalability in handling user interactions.
The system focuses on enhancing the user experience by providing tangible rewards for engaging with the platform. Achievements and badges serve as incentives for users to watch more lessons and write more comments, increasing their interaction with the portal.
The Course Portal Achievements System is a user-centric feature that by unlocking achievements and earning badges, users are encouraged to participate more actively in the learning process. The event-driven architecture ensures seamless integration with existing platform functionalities.