Blame view

common/models/Language.php 653 Bytes
dd15bb0c   alex   Merge branches 'c...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  <?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;
      }
  
  
  }