public function actionUpdate($id)
{
$model = Topic::findTopic($id);
if (!($model && (User::getThrones() || $model->isCurrent()))) {
throw new NotFoundHttpException();
}
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->save()) {
$this->flash('发表更新成功!', 'success');
return $this->redirect(['view', 'id' => $model->id]);
}
} else {
return $this->render('update', ['model' => $model]);
}
}