| xqd
@@ -192,9 +192,9 @@ class InfoController extends Controller
|
|
|
* 删除
|
|
|
*/
|
|
|
public function destroy(Request $reqeust) {
|
|
|
- $bool = $this->repository->destroy($reqeust->get('id'));
|
|
|
- if($bool) {
|
|
|
- $old_data_pics = DreamInfoModel::find($reqeust->get('id'))->imgs->toArray();
|
|
|
+ $dream = DreamInfoModel::find($reqeust->get('id'));
|
|
|
+ if($dream) {
|
|
|
+ $old_data_pics = $dream->imgs->toArray();
|
|
|
$old_pics = array_column($old_data_pics,'pic');
|
|
|
if (!empty($old_pics)) {
|
|
|
foreach ($old_pics as $old_pic){
|
| xqd
@@ -205,6 +205,7 @@ class InfoController extends Controller
|
|
|
}
|
|
|
}
|
|
|
DreamImages::where('dream_id',$reqeust->get('id'))->delete();
|
|
|
+ $this->repository->destroy($reqeust->get('id'));
|
|
|
return $this->showMessage('操作成功');
|
|
|
}else{
|
|
|
return $this->showWarning("操作失败");
|