|
@@ -192,19 +192,20 @@ class InfoController extends Controller
|
|
* 删除
|
|
* 删除
|
|
*/
|
|
*/
|
|
public function destroy(Request $reqeust) {
|
|
public function destroy(Request $reqeust) {
|
|
- $bool = $this->repository->destroy($reqeust->get('id'));
|
|
|
|
- if($bool) {
|
|
|
|
- $old_data_pics = DreamInfoModel::find($reqeust->get('id'))->imgs->toArray();
|
|
|
|
- $old_pics = array_column($old_data_pics,'pic');
|
|
|
|
- if (!empty($old_pics)) {
|
|
|
|
- foreach ($old_pics as $old_pic){
|
|
|
|
- if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
|
|
|
|
- unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
|
|
|
|
- }
|
|
|
|
- BaseAttachmentModel::where('url',$old_pic)->delete();
|
|
|
|
|
|
+// 暂时不删除图片文件 msyh
|
|
|
|
+ /* $old_data_pics = DreamInfoModel::find($reqeust->get('id'))->imgs->toArray();
|
|
|
|
+ $old_pics = array_column($old_data_pics,'pic');
|
|
|
|
+ if (!empty($old_pics)) {
|
|
|
|
+ foreach ($old_pics as $old_pic){
|
|
|
|
+ if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
|
|
|
|
+ unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
|
|
}
|
|
}
|
|
|
|
+ BaseAttachmentModel::where('url',$old_pic)->delete();
|
|
}
|
|
}
|
|
- DreamImages::where('dream_id',$reqeust->get('id'))->delete();
|
|
|
|
|
|
+ }*/
|
|
|
|
+ DreamImages::where('dream_id',$reqeust->get('id'))->delete();
|
|
|
|
+ $bool = $this->repository->destroy($reqeust->get('id'));
|
|
|
|
+ if($bool) {
|
|
return $this->showMessage('操作成功');
|
|
return $this->showMessage('操作成功');
|
|
}else{
|
|
}else{
|
|
return $this->showWarning("操作失败");
|
|
return $this->showWarning("操作失败");
|