/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function DeleteAction($id) { $product = products::find($id); if ($product) { foreach ($product->image as $img) { @unlink(public_path() . '/images/' . $img->path); $img->delete(); } $product->delete(); return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The product table item has been successfully deleted'])); } return redirect()->route('cake/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The product table item can not delete'])); }
/** Get Product id and find image id*/ public function ManageOption($id) { $parent_category_layout = $this->parent_category_layout; $product = products::find($id); return view('admin/image/image_manage', compact('product', 'parent_category_layout')); }