public function init() { $this->languages = Languages::find()->asArray()->all(); if (Yii::$app->request->get('lang')) { $this->current_lang = Yii::$app->request->get('lang'); } else { $this->current_lang = $this->languages[0]['id']; } }
/** * @return \yii\db\ActiveQuery */ public function getLanguage() { return $this->hasOne(Languages::className(), ['id' => 'language_id']); }