PHP code example of sichkarev / yii2-translatable-attributes

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

    

sichkarev / yii2-translatable-attributes example snippets


$this->addColumn('table','translations', $this->json()->comment('Переводы'));

if ($promocodeType = PromocodeType::findOne(1)) {
    $promocodeType->name = 'Русский';
    $promocodeType->nameUa = 'Украинский';
    $promocodeType->setLangContext(new Ukrainian());
    echo $promocodeType->name; //Украинский
}

php yii migrate --migrationPath=@vendor/sichkarev/yii2-translatable-attributes/src/Migrations --interactive=0