PHP code example of integready / yii2-bulkactionscheckboxcolumn

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

    

integready / yii2-bulkactionscheckboxcolumn example snippets




use integready\bulkactionscheckboxcolumn\BulkCheckboxColumn;
use kartik\grid\GridView;




namespace app\controllers;

use Yii;
use yii\web\Controller;
use backend\models\Book;
use yii\helpers\ArrayHelper;
use backend\models\BookSearch;

/**
 * BookController implements the CRUD actions for Site model.
 */
class BookController extends Controller
{
    /**
     * @inheritdoc
     */
    public function actions()
    {
        return ArrayHelper::merge(parent::actions(), [
            'bulk_available'        => [
                'class'                 => BulkCheckboxAction::className(),
                'modelClass'            => Book::className(),
                'gridId'                => 'books-grid',
                'statusField'           => 'available',
                'updateType'            => BulkCheckboxAction::UPDATE_TYPE_ONEBYONE,
            ],
            // ...Many actions
            'bulk_intl_shipping'    => [
                'class'                 => BulkCheckboxAction::className(),
                'modelClass'            => Book::className(),
                'gridId'                => 'books-grid',
                'statusField'           => 'intl_shipping',
            ],
        ]);
    }

    /**
     * Index page
     *
     * @return mixed
     */
    public function actionIndex()
    {
        $this->runAction('bulk_available');
        // ...Many actions with run
        $this->runAction('bulk_intl_shipping');

        $searchModel  = new BookSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchModel'  => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

    // Other actions and methods
}