mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange.git
synced 2026-08-19 04:14:04 +00:00
clear test user data
This commit is contained in:
+11
-9
@@ -100,15 +100,17 @@ class Booking extends Model
|
||||
return $this->hasOne(Invoice::class);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->supplierBooking()->delete();
|
||||
$this->chinaBankSlip()->delete();
|
||||
$this->userBankSlip()->delete();
|
||||
$this->purchaseOrder()->delete();
|
||||
$this->invoice()->delete();
|
||||
|
||||
return parent::delete();
|
||||
public static function boot() {
|
||||
parent::boot();
|
||||
self::deleting(function($booking) {
|
||||
$booking->userBankSlip()->delete();
|
||||
$booking->supplierBooking()->delete();
|
||||
$booking->chinaBankSlip()->each(function($bankslip) {
|
||||
$bankslip->delete();
|
||||
});
|
||||
$booking->purchaseOrder()->delete();
|
||||
$booking->invoice()->delete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-6
@@ -20,11 +20,15 @@ class Invoice extends Model
|
||||
return $this->hasMany(InvoiceStatuses::class);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->invoiceDetails()->delete();
|
||||
$this->invoiceStatuses()->delete();
|
||||
|
||||
return parent::delete();
|
||||
public static function boot() {
|
||||
parent::boot();
|
||||
self::deleting(function($invoice) {
|
||||
$invoice->invoiceDetails()->each(function($invoiceDetails) {
|
||||
$invoiceDetails->delete();
|
||||
});
|
||||
$invoice->invoiceStatuses()->each(function($invoiceStatuses) {
|
||||
$invoiceStatuses->delete();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user