public function actionUpdate($id)
{
$model = Tag::findOne(['id' => $id, 'store_id' => Yii::$app->user->identity->store_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]);
}