maks757/yii2-virtual-points

Installs: 37

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:yii2-extension

0.2.2 2016-11-03 16:27 UTC

This package is not auto-updated.

Last update: 2024-11-23 20:53:32 UTC


README

status extension dev

Install

composer.phar require maks757/yii2-virtual-point

or

composer require maks757/yii2-virtual-point

and applying migrations

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

or

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

Configuration

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

Using

   //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);
   //

Using example

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

Alt text