Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public function actionDelete($id)
  2. {
  3. if(Yii::app()->request->isPostRequest)
  4. {
  5. // we only allow deletion via POST request
  6. $this->loadModel($id)->delete();
  7.  
  8. // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser
  9. if(!isset($_GET['ajax']))
  10. $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin'));
  11. }
  12. else
  13. throw new CHttpException(400,'Invalid request. Please do not repeat this request again.');
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement