protected function findModel($id)
 {
     if (($model = Settings::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 public function getAllSettings()
 {
     $settings = SettingsModel::find()->where(['module_name' => $this->modulename])->all();
     $settingsOut = null;
     foreach ($settings as $setting) {
         $settingsOut[] = ['key' => $setting->key_name, 'value' => $setting->value];
     }
     return $settingsOut;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Settings::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, 'active' => $this->active, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'module_name', $this->module_name])->andFilterWhere(['like', 'key_name', $this->key_name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'value', $this->value])->andFilterWhere(['like', 'type', $this->type]);
     return $dataProvider;
 }
 /**
  * Finds the Settings model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Settings the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     //find()->where(['module_name' => $this->module->modulename])->all()
     if (($model = Settings::find()->where(['id' => $id, 'module_name' => $this->module->modulename])->one()) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }