public function beforeDelete() { foreach ($this->photo as $value) { $item = SiteImage::FindByPk($value->Pk); $this->deleteImage($item); $item->delete(); } return parent::beforeDelete(); }
public function beforeDelete() { foreach ($this->photo as $value) { $item = SiteImage::FindByPk($value->Pk); $this->deleteImage($item); $item->delete(); } $tmp = new \SplFileInfo(ROOT_PATH_PUBLIC . $item->image); rmdir($tmp->getPath()); return parent::beforeDelete(); }
public function actionSaveImage() { $item = SiteImage::FindByPk($this->app->request->post->id); $item->title = $this->app->request->post->title; $item->save(); }