获取已经删除过的话题
public static findDeletedTopic ( $id ) : array | |
||
$id | ||
Résultat | array | |
/** * 撤消删除 * @param $id * @return \yii\web\Response * @throws NotFoundHttpException */ public function actionRevoke($id) { $model = Topic::findDeletedTopic($id); if (!$model->isCurrent()) { throw new NotFoundHttpException(); } $model->updateCounters(['status' => 1]); $this->flash("「{$model->title}」文章撤销删除成功。", 'success'); return $this->redirect(['/topic/default/view', 'id' => $model->id]); }
/** * 撤消删除 * @param $id * @return \yii\web\Response * @throws NotFoundHttpException */ public function actionRevoke($id) { $model = Topic::findDeletedTopic($id); if (!($model && (User::getThrones() || $model->isCurrent()))) { throw new NotFoundHttpException(); } TopicService::revoke($model); $this->flash("「{$model->title}」文章撤销删除成功。", 'success'); return $this->redirect(['/topic/default/view', 'id' => $model->id]); }