frontend\modules\topic\models\Topic::findDeletedTopic PHP Méthode

findDeletedTopic() public static méthode

获取已经删除过的话题
public static findDeletedTopic ( $id ) : array | Topic | null | ActiveRecord
$id
Résultat array | Topic | null | ActiveRecord
    public static function findDeletedTopic($id)
    {
        return static::findModel($id, ['>=', 'status', self::STATUS_DELETED]);
    }

Usage Example

 /**
  * 撤消删除
  * @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]);
 }
All Usage Examples Of frontend\modules\topic\models\Topic::findDeletedTopic