PHP code example of sunlab / wn-gamification-plugin

1. Go to this page and download the library: Download sunlab/wn-gamification-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sunlab / wn-gamification-plugin example snippets


\Winter\User\Models\User::extend(function ($user) {
    Event::listen('winter.user.activate', function($user) {
        $user->attachBadge('Verified User');
    });
});

if ($user->haBadge('Verified User')) {
    // User has the 'Verified User' badge
}

\Winter\User\Models\User::extend(function ($user) {
    $user->bindEvent('model.afterCreate', function () use ($user) {
        $user->incrementMeasure('registered');
    });
});