PHP code example of rmrevin / yii2-changelog
1. Go to this page and download the library: Download rmrevin/yii2-changelog 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/ */
rmrevin / yii2-changelog example snippets
'modules' => [
// ...
'debug' => [
'class' => yii\debug\Module::className(),
'panels' => [
rmrevin\yii\changelog\debug\panels\ChangelogPanel::class,
],
],
],
use rmrevin\yii\changelog\interfaces\LoggableInterface;
use rmrevin\yii\changelog\behaviors\ChangelogBehavior;
use yii\db\ActiveRecord;
/**
* Class ShopItem
*
* @property integer $id
* @property integer $number
* @property string $title
* @property integer $created_at
* @property integer $updated_at
* @property integer $synchronized_at
*/
class ShopItem extends ActiveRecord implements LoggableInterface
{
/**
* @inheritdoc
*/
public function __toString()
{
return sprintf('[%s] %s', $this->number, $this->title);
}
/**
* @inheritdoc
*/
public function behaviors()
{
return [
// ...
[
'class' => ChangelogBehavior::class,
'ignoreAttributes' => [ // these attributes are not tracked
'updated_at',
'synchronized_at',
],
],
];
}
}
php yii migrate --migrationPath=@rmrevin/yii/changelog/migrations