public function delete(Product $product) { //DELETE all related photos $product_photos = ProductPhoto::where("product_id", "=", $product->id)->get(); foreach ($product_photos as $photo) { $this->rmFile($photo->img); $this->rmFile($photo->img_orig); } $product->delete(); return redirect('cms/product/product'); }