/** * 获取配置参数 * @return null|static */ public function getConfig() { $config = SinaConfig::findOne(['id' => '1']); return $config; }
/** * Finds the SinaConfig model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SinaConfig the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SinaConfig::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * 获取商户2的配置参数 * @return null|static */ public static function getConfigtwo() { $config = SinaConfig::findOne(['id' => '2']); return $config; }