1pppp

Untitled

Sep 6th, 2020
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public function destroy($id, Image $image)
  2. {
  3. // $product = Product::find($id);
  4. // $product = new Product;
  5. //
  6. // $product = $product->id;
  7. $product = Product::where('id',$id)->firstOrFail();
  8. // $product = $product->id;
  9. // dd($product);
  10. // Storage::disk('public')->delete('uploads/product_images/'.$image->id);
  11. // Storage::disk('public/uploads/product_images/')->delete($image->path);
  12. $product->delete();
  13. // $products = $image->product;
  14. Storage::disk('public')->delete('uploads/product_images/'.$image->id);
  15. $image->delete();
  16. // return redirect()->route('product.edit', ['id' => $image->product_id]);
  17. // return redirect('edit');
  18. return redirect('products')->with('a', ',Товар удален');
  19.  
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment