demos/blog/protected/controllers/CommentController.php
public function actionDelete()
	{
		if(Yii::app()->request->isPostRequest)
		{
			// we only allow deletion via POST request
			$this->loadModel()->delete();

			// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
			if(!isset($_POST['ajax']))
				$this->redirect(array('index'));
		}
		else
			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
	}
public function actionDelete()
	{
		if(Yii::app()->request->isPostRequest)
		{
			// we only allow deletion via POST request
			$this->loadModel()->delete();

			// if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
			if(!isset($_POST['ajax']))
				$this->redirect(array('index'));
		}
		else
			throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
	}
public function actionDelete ( ) { if ( Yii :: app ( ) -> request -> isPostRequest ) { // we only allow deletion via POST request $ this -> loadModel ( ) -> delete ( ) ; // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if ( ! isset ( $ _POST [ 'ajax' ] ) ) $ this -> redirect ( array ( 'index' ) ) ; } else throw new CHttpException ( 400 , 'Invalid request. Please do not repeat this request again.' ) ; }
Deletes a particular model.
If deletion is successful, the browser will be redirected to the 'index' page.
Deletes a particular model . If deletion is successful the browser will be redirected to the index page .