mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
Merge branch 'fix-delete-condition' into 'master'
Fix transaction delete issue See merge request mohit.panjvani/crater-web!1456
This commit is contained in:
@ -300,6 +300,10 @@ class Company extends Model implements HasMedia
|
||||
if ($this->invoices()->exists()) {
|
||||
$this->invoices->map(function ($invoice) {
|
||||
$this->checkModelData($invoice);
|
||||
|
||||
if ($invoice->transactions()->exists()) {
|
||||
$invoice->transactions()->delete();
|
||||
}
|
||||
});
|
||||
|
||||
$this->invoices()->delete();
|
||||
|
||||
@ -139,7 +139,12 @@ class Customer extends Authenticatable implements HasMedia
|
||||
}
|
||||
|
||||
if ($customer->invoices()->exists()) {
|
||||
$customer->invoices()->delete();
|
||||
$customer->invoices->map(function ($invoice) {
|
||||
if ($invoice->transactions()->exists()) {
|
||||
$invoice->transactions()->delete();
|
||||
}
|
||||
$invoice->delete();
|
||||
});
|
||||
}
|
||||
|
||||
if ($customer->payments()->exists()) {
|
||||
|
||||
Reference in New Issue
Block a user