mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 04:01:10 -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()) {
|
if ($this->invoices()->exists()) {
|
||||||
$this->invoices->map(function ($invoice) {
|
$this->invoices->map(function ($invoice) {
|
||||||
$this->checkModelData($invoice);
|
$this->checkModelData($invoice);
|
||||||
|
|
||||||
|
if ($invoice->transactions()->exists()) {
|
||||||
|
$invoice->transactions()->delete();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->invoices()->delete();
|
$this->invoices()->delete();
|
||||||
|
|||||||
@ -139,7 +139,12 @@ class Customer extends Authenticatable implements HasMedia
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($customer->invoices()->exists()) {
|
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()) {
|
if ($customer->payments()->exists()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user