PHP code example of porcelanosa / yii2-toggle-column
1. Go to this page and download the library: Download porcelanosa/yii2-toggle-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/ */
porcelanosa / yii2-toggle-column example snippets
composer
use porcelanosa\yii2togglecolumn\ToggleAction;
use app\models\Artists;
class ArtistsController extends Controller
{
//.............
public function actions() {
return [
'toggle' => [
'class' => ToggleAction::className(),
'modelClass' => Artists::className(),
// Uncomment to enable flash messages
//'setFlash' => true,
'attribute' => 'active',
'primaryKey' => 'id'
],
]
}
//.......
}