public function actionUpdate($id)
{
$model = School::findOne($id);
if (!$model) {
throw new NotFoundHttpException('未找到该学校。');
}
if ($model->load(Yii::$app->request->post())) {
if ($model->save()) {
Yii::$app->session->setFlash('success', '成功更新学校“' . $model->name . '”。');
return $this->refresh();
} else {
Yii::$app->session->setFlash('danger', '更新学校失败。');
}
}
return $this->render('form', ['model' => $model]);
}