public function actionDeleteAttachment($id) { $attachment = Attachment::findOne($id); $document_id = $attachment->document_id; $attachment->delete(); return $this->redirect(['update', 'id' => $document_id]); }
public function actionDelete($id) { \Yii::$app->response->format = Response::FORMAT_JSON; /* @var $model Attachment */ if (Attachment::findOne($id)->delete()) { return ['success' => true]; } return ['success' => false]; }
public function loadAttachment($id) { if (($document = Attachment::findOne($id)) !== null) { return $document; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }