<?php
/**
 * Created by PhpStorm.
 * User: alex
 * Date: 30.05.18
 * Time: 16:20
 */

namespace common\models;
use artbox\core\models\Language as CoreLanguage;

class Language extends CoreLanguage
{

    public static $active=null;

    /**
     * Get active Languages and cache them
     *
     * @return array|\artbox\core\models\Language[]|null|\yii\db\ActiveRecord[]
     */
    public static function getActive()
    {
        if (empty(self::$active)) {
            self::$active = self::find()
                ->where([ 'status' => true ])
                ->indexBy('id')
                ->all();
        }
        return self::$active;
    }


}