mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 12:54:31 -04:00
Fix delete company code
This commit is contained in:
parent
985356daf2
commit
d90ab5bb53
@ -1355,20 +1355,18 @@ class AccountController extends BaseController
|
|||||||
$account = Auth::user()->account;
|
$account = Auth::user()->account;
|
||||||
\Log::info("Canceled Account: {$account->name} - {$user->email}");
|
\Log::info("Canceled Account: {$account->name} - {$user->email}");
|
||||||
|
|
||||||
|
$refunded = false;
|
||||||
|
if (! $account->hasMultipleAccounts()) {
|
||||||
$company = $account->company;
|
$company = $account->company;
|
||||||
$refunded = $company->processRefund(Auth::user());
|
$refunded = $company->processRefund(Auth::user());
|
||||||
|
}
|
||||||
|
|
||||||
Document::scope()->each(function ($item, $key) {
|
Document::scope()->each(function ($item, $key) {
|
||||||
$item->delete();
|
$item->delete();
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->accountRepo->unlinkAccount($account);
|
$this->accountRepo->unlinkAccount($account);
|
||||||
|
|
||||||
if ($account->hasMultipleAccounts()) {
|
|
||||||
$account->forceDelete();
|
$account->forceDelete();
|
||||||
} else {
|
|
||||||
$account->company->forceDelete();
|
|
||||||
}
|
|
||||||
|
|
||||||
Auth::logout();
|
Auth::logout();
|
||||||
Session::flush();
|
Session::flush();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user