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:
@@ -100,6 +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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,4 +19,12 @@ class Invoice extends Model
|
||||
public function invoiceStatuses() {
|
||||
return $this->hasMany(InvoiceStatuses::class);
|
||||
}
|
||||
|
||||
public function delete()
|
||||
{
|
||||
$this->invoiceDetails()->delete();
|
||||
$this->invoiceStatuses()->delete();
|
||||
|
||||
return parent::delete();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-15
@@ -17,21 +17,7 @@ Route::get('/', 'WelcomeController@index');
|
||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
|
||||
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');
|
||||
Route::get('/clear-test', function(){
|
||||
$bookings = \App\Booking::where('user_id', 1)->get();
|
||||
foreach ($bookings as $booking){
|
||||
var_dump($booking->invoice());
|
||||
if($booking->invoice()){
|
||||
// $booking->invoice->invoiceDetails->delete();
|
||||
$booking->invoice->invoiceStatuses;
|
||||
// $booking->invoice->delete();
|
||||
}
|
||||
// if($booking->supplierBooking) { $booking->supplierBooking->delete(); }
|
||||
// if($booking->chinaBankSlip) { $booking->chinaBankSlip->delete(); }
|
||||
// if($booking->userBankSlip) { $booking->userBankSlip->delete(); }
|
||||
// if($booking->purchaseOrder) { $booking->purchaseOrder->delete(); }
|
||||
// if($booking->invoice) { $booking->invoice->delete(); }
|
||||
}
|
||||
// $bookings->delete();
|
||||
\App\Booking::where('user_id', 1)->delete();
|
||||
});
|
||||
|
||||
Route::get('/po-approval', function(){
|
||||
|
||||
Reference in New Issue
Block a user