/**
  * Delete model with files
  * @param $id
  * @return array
  */
 public function actionDelete($id)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $model = GalleryPhoto::findOne($id);
     if ($model->isImage()) {
         $model->deleteThumbs();
     }
     $model->deleteFile();
     $model->delete();
     return ['success' => 'true'];
 }
예제 #2
0
 public function getPhotosArray()
 {
     $photos = GalleryPhoto::find()->where(['gallery_id' => $this->id])->all();
     return $photos;
 }