public function actionStatus($id)
    {
        $model = $this->findModel($id);
        if($model->status == "active") {
            $model->status = "inactive";
        } else {
            $model->status = "active";
        }
        $model->save(false);
        if(Yii::$app->request->getIsAjax()) {
            Yii::$app->response->format = 'json';
            return ['success' => true];
        } else {
            return $this->redirect(['index']);
        }
    }
public function actionStatus($id)
    {
        $model = $this->findModel($id);
        if($model->status == "active") {
            $model->status = "inactive";
        } else {
            $model->status = "active";
        }
        $model->save(false);
        if(Yii::$app->request->getIsAjax()) {
            Yii::$app->response->format = 'json';
            return ['success' => true];
        } else {
            return $this->redirect(['index']);
        }
    }
public function actionStatus ( $ id ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> status == "active" ) { $ model -> status = "inactive" ; } else { $ model -> status = "active" ; } $ model -> save ( false ) ; if ( Yii :: $ app -> request -> getIsAjax ( ) ) { Yii :: $ app -> response -> format = 'json' ; return [ 'success' => true ] ; } else { return $ this -> redirect ( [ 'index' ] ) ; } }
Deletes an existing Faq model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed
Deletes an existing Faq model . If deletion is successful the browser will be redirected to the index page .