PHP code example of fgh151 / yii2-vote-column

1. Go to this page and download the library: Download fgh151/yii2-vote-column 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/ */

    

fgh151 / yii2-vote-column example snippets



use yii\grid\GridView;

echo  GridView::widget([
         'dataProvider' => $dataProvider,
         'filterModel' => $searchModel,
         'columns' => [
             ['class' => 'yii\grid\SerialColumn'],
             [
                 'class' => 'fgh151\vote\VoteColumn',
                 'attribute' => 'vote',
                 'onText' => 'Approve',
                 'offText' => 'Not approve',
                 'action' => 'controller/ajax-vote',
                 'filterInputOptions' => [
                     'class' => 'form-control'
                 ]
             ],
         ],
     ]);
 

php composer.phar 
yii\grid\DataColumn.php