From 8545d5ef3cdc3858e7ffef753c682622f76f05e9 Mon Sep 17 00:00:00 2001 From: jitendra Date: Fri, 6 Sep 2019 19:46:25 +0530 Subject: [PATCH] Unlimited download link issue fixed --- .../Http/Controllers/DownloadableProductController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php b/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php index b0b14bd92..79c8d31b2 100644 --- a/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php +++ b/packages/Webkul/Shop/src/Http/Controllers/DownloadableProductController.php @@ -78,10 +78,12 @@ class DownloadableProductController extends Controller $remainingDownloads = $downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + 1); - $this->downloadableLinkPurchasedRepository->update([ - 'download_used' => $downloadableLinkPurchased->download_used + 1, - 'status' => $remainingDownloads <= 0 ? 'expired' : $downloadableLinkPurchased->status - ], $downloadableLinkPurchased->id); + if ($downloadableLinkPurchased->download_bought) { + $this->downloadableLinkPurchasedRepository->update([ + 'download_used' => $downloadableLinkPurchased->download_used + 1, + 'status' => $remainingDownloads <= 0 ? 'expired' : $downloadableLinkPurchased->status + ], $downloadableLinkPurchased->id); + } if ($downloadableLinkPurchased->type == 'file') { return Storage::download($downloadableLinkPurchased->file);