1. Go to this page and download the library: Download yii2mod/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/ */
public function actions()
{
return [
'toggle' => [
'class' => \yii2mod\toggle\actions\ToggleAction::class,
'modelClass' => 'path\to\your\Model',
// if you want to use flash messages
'setFlash' => true,
'flashSuccess' => 'Success message',
'flashError' => 'Error message',
'redirect' => 'some-redirect-url',
// if you want to use custom code before saving the model
'preProcess' => function() {
// your custom code
}
],
];
}
php composer.phar
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.