mirror of
https://github.com/crater-invoice/crater.git
synced 2025-12-15 09:52:55 -05:00
solve payment method delete issue
This commit is contained in:
@@ -698,4 +698,19 @@ class Invoice extends Model implements HasMedia
|
||||
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public static function deleteInvoices($ids)
|
||||
{
|
||||
foreach ($ids as $id) {
|
||||
$invoice = self::find($id);
|
||||
|
||||
if ($invoice->transactions()->exists()) {
|
||||
$invoice->transactions()->delete();
|
||||
}
|
||||
|
||||
$invoice->delete();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@ class PaymentMethod extends Model
|
||||
return $this->hasMany(Payment::class);
|
||||
}
|
||||
|
||||
public function expenses()
|
||||
{
|
||||
return $this->hasMany(Expense::class);
|
||||
}
|
||||
|
||||
public function company()
|
||||
{
|
||||
return $this->belongsTo(Company::class);
|
||||
|
||||
Reference in New Issue
Block a user