diff --git a/app/Services/Finance/CashService.php b/app/Services/Finance/CashService.php index 0227a27..cd50ec0 100644 --- a/app/Services/Finance/CashService.php +++ b/app/Services/Finance/CashService.php @@ -283,7 +283,6 @@ function () use ($transaction): void { $account = $transaction->cashAccount; - $transaction->clearMediaCollection('photos'); $transaction->delete(); $this->recalculateBalances($account); diff --git a/app/Services/Finance/ExpenseService.php b/app/Services/Finance/ExpenseService.php index 9d164e2..fde645e 100644 --- a/app/Services/Finance/ExpenseService.php +++ b/app/Services/Finance/ExpenseService.php @@ -133,7 +133,6 @@ function () use ($expense): void { $this->cashService->deleteReferencedTransaction($expense->cashTransaction); } - $expense->clearMediaCollection('photos'); $expense->delete(); }, 'Gagal menghapus pengeluaran', diff --git a/app/Services/Hr/AttendanceService.php b/app/Services/Hr/AttendanceService.php index cb11cb1..7bd7dbf 100644 --- a/app/Services/Hr/AttendanceService.php +++ b/app/Services/Hr/AttendanceService.php @@ -172,8 +172,6 @@ public function delete(Attendance $attendance, User $user): void $this->runInTransaction( function () use ($attendance): void { - $attendance->clearMediaCollection('checkin'); - $attendance->clearMediaCollection('checkout'); $attendance->delete(); }, 'Gagal menghapus presensi', diff --git a/app/Services/Manage/CuttingService.php b/app/Services/Manage/CuttingService.php index 8a5e840..e2aed66 100644 --- a/app/Services/Manage/CuttingService.php +++ b/app/Services/Manage/CuttingService.php @@ -680,7 +680,6 @@ function () use ($cutting): void { $cutting->materials()->delete(); $cutting->results()->delete(); - $cutting->clearMediaCollection('images'); $cutting->delete(); }, 'Gagal menghapus proses cutting', diff --git a/app/Services/Manage/PurchaseService.php b/app/Services/Manage/PurchaseService.php index fa2dcce..2e8f21d 100644 --- a/app/Services/Manage/PurchaseService.php +++ b/app/Services/Manage/PurchaseService.php @@ -716,7 +716,6 @@ private function rejectCreate(OwnerVerificationRequest $verificationRequest): vo $this->runInTransaction( function () use ($purchase): void { - $purchase->clearMediaCollection('photos'); $purchase->items()->delete(); $purchase->delete(); }, @@ -734,7 +733,6 @@ function () use ($purchase): void { $this->decrementStock($item); } - $purchase->clearMediaCollection('photos'); $purchase->items()->delete(); $purchase->delete(); }, diff --git a/app/Services/Manage/RestockService.php b/app/Services/Manage/RestockService.php index a9233ea..7072d4e 100644 --- a/app/Services/Manage/RestockService.php +++ b/app/Services/Manage/RestockService.php @@ -573,7 +573,6 @@ private function rejectCreate(OwnerVerificationRequest $verificationRequest): vo $this->runInTransaction( function () use ($restock): void { - $restock->clearMediaCollection('photos'); $restock->items()->delete(); $restock->delete(); }, @@ -593,7 +592,6 @@ function () use ($restock): void { $this->decrementStock($item, $stockType); } - $restock->clearMediaCollection('photos'); $restock->items()->delete(); $restock->delete(); }, diff --git a/app/Services/Master/ProductService.php b/app/Services/Master/ProductService.php index 206cf79..eef5564 100644 --- a/app/Services/Master/ProductService.php +++ b/app/Services/Master/ProductService.php @@ -523,7 +523,6 @@ private function applyPayloadToProduct( ->whereNotIn('id', $submittedVariantIds) ->get() ->each(function (ProductVariant $variant): void { - $variant->clearMediaCollection('images'); $variant->delete(); }); @@ -590,9 +589,6 @@ private function applyDeleteSubject(Product $product): void { $this->runInTransaction( function () use ($product): void { - $product->variants()->each(function (ProductVariant $variant): void { - $variant->clearMediaCollection('images'); - }); $product->variants()->delete(); $product->categories()->detach(); $product->delete(); @@ -660,9 +656,6 @@ private function rejectCreate(OwnerVerificationRequest $verificationRequest): vo $this->runInTransaction( function () use ($product): void { - $product->variants()->each(function (ProductVariant $variant): void { - $variant->clearMediaCollection('images'); - }); $product->variants()->delete(); $product->categories()->detach(); $product->delete(); diff --git a/app/Services/Master/RawMaterialService.php b/app/Services/Master/RawMaterialService.php index 85dbbd4..01811c0 100644 --- a/app/Services/Master/RawMaterialService.php +++ b/app/Services/Master/RawMaterialService.php @@ -286,9 +286,6 @@ private function applyDeleteSubject(RawMaterial $rawMaterial): void { $this->runInTransaction( function () use ($rawMaterial): void { - $rawMaterial->prices()->each(function (RawMaterialPrice $price): void { - $price->clearMediaCollection('images'); - }); $rawMaterial->prices()->delete(); $rawMaterial->delete(); }, @@ -340,7 +337,6 @@ private function applyPayloadToRawMaterial( ->whereNotIn('id', $submittedPriceIds) ->get() ->each(function (RawMaterialPrice $price): void { - $price->clearMediaCollection('images'); $price->delete(); }); @@ -386,9 +382,6 @@ private function rejectCreate(OwnerVerificationRequest $verificationRequest): vo $this->runInTransaction( function () use ($rawMaterial): void { - $rawMaterial->prices()->each(function (RawMaterialPrice $price): void { - $price->clearMediaCollection('images'); - }); $rawMaterial->prices()->delete(); $rawMaterial->delete(); },