Beispiel #1
0
 public static function getConfigValue($group, $name, $default = null)
 {
     $model = GlobalConfig::findOne(['config_group' => $group, 'config_name' => $name]);
     return $model ? $model->config_value : $default;
 }
 /**
  * Finds the GlobalConfig model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $config_group
  * @param string $config_name
  * @return GlobalConfig the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($config_group, $config_name)
 {
     if (($model = GlobalConfig::findOne(['config_group' => $config_group, 'config_name' => $config_name])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }