PHP code example of godzie44 / yii2-thumbs-up

1. Go to this page and download the library: Download godzie44/yii2-thumbs-up 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/ */

    

godzie44 / yii2-thumbs-up example snippets



return [
	// ...
	'modules' => [
      /* other modules */
        
		'thumbsup' => [
            'class' => 'godzie44\yii\module\thumbsup\Module',
			      'useRbac' => true, 
			      ]
    ],
	// ...
];


use godzie44\yii\module\thumbsup;

$thumbsUpChange = new \yii\rbac\Permission([
            'name' => thumbsup\Permission::CHANGE,
            'description' => 'Can change thumb state',
        ]);
$authManager->add($thumbsUpChange);


public function actions()
    {
        return [
            'thumb-rate' => [
                'class' => 'godzie44\yii\module\thumbsup\ThumbRateAction'
            ],

            /* other actions */
        ];
    }


// ...

use godzie44\yii\module\thumbsup;

echo thumbsup\widgets\ThumbsUpWidget::widget(['entity' => "entity-44"]);


php yii migrate/up --migrationPath=@vendor/godzie44/yii2-thumbs-up/migrations/