maks757/yii2-virtual-points

安装次数: 35

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

0.2.2 2016-11-03 16:27 UTC

This package is not auto-updated.

Last update: 2024-09-28 19:36:43 UTC


README

状态:扩展开发中

安装

composer.phar require maks757/yii2-virtual-point

composer require maks757/yii2-virtual-point

应用迁移

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

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

配置

main.php (配置文件)
'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);
    //

Alt text