PHP code example of maks757 / yii2-virtual-points

1. Go to this page and download the library: Download maks757/yii2-virtual-points 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/ */

    

maks757 / yii2-virtual-points example snippets


'components' => [
    // Point config
    'points' => [
        'class' => \bl\virtual_points\Points::className(),
        
        //Set key
        'category' => 'auth' //or User::className(),
        //or
        //'ar_object' => new User(),
    ],
    // ...
]

   //add point to user
   $user = User::find()->one();
   /** @var $point Points */
   $size_point = User::POINT_ADD_WINNER // or integer
   $point = Yii::$app->points;
   $point->ar_object = $user;
   $point->addPoint($size_point);
   //

    //get points
    /** @var $point Points */
    $point = Yii::$app->points;
    $points = $point->getAllPoint();
    //or
    //$points = $point->getPoint($object_id);
    //

php yii migrate --migrationPath=@vendor/maks757/yii2-virtual-point/migrations