/**
  * Updates an existing HostsSkillDetails model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id
  * @return mixed
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $emailtempaltemodel = EmailTemplates::find()->where(['email_key' => 'host_signup'])->multilingual()->one();
         $admin_email = Configurations::find()->where(['key' => 'admin_email'])->one();
         Yii::$app->mailer->compose('hosts-html', ['model' => $model, 'emailtempaltemodel' => $emailtempaltemodel])->setFrom($admin_email->value)->setTo($model->email)->setCc($admin_email->value)->setSubject($emailtempaltemodel->subject)->send();
         return $this->redirect(['site/home']);
     } else {
         return $this->render('update', ['model' => $model, 'host_id' => $model->host_id]);
     }
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Configurations::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'key', $this->key])->andFilterWhere(['like', 'value', $this->value]);
     return $dataProvider;
 }
 /**
  * Creates a new Subscribers model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Subscribers();
     if (isset($_GET['message'])) {
         $message = $_GET['message'];
     } else {
         $message = '';
     }
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $emailtempaltemodel = EmailTemplates::find()->where(['email_key' => $model->type])->multilingual()->one();
         $admin_email = Configurations::find()->where(['key' => 'admin_email'])->one();
         Yii::$app->mailer->compose('subscribers-html', ['model' => $model, 'emailtempaltemodel' => $emailtempaltemodel])->setFrom($admin_email->value)->setTo($model->email)->setCc($admin_email->value)->setSubject($emailtempaltemodel->subject)->send();
         return $this->redirect(['create', 'message' => 'you are subscribed now']);
     } else {
         return $this->render('create', ['model' => $model, 'message' => $message]);
     }
 }
 /**
  * Finds the Configurations model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Configurations the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Configurations::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }