/** * 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']; }
public function getPhotosArray() { $photos = GalleryPhoto::find()->where(['gallery_id' => $this->id])->all(); return $photos; }