1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #3839 from turbo124/v2

Fixes for delete company route
This commit is contained in:
David Bomba 2020-06-25 08:05:03 +10:00 committed by GitHub
commit fdf633ced8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -57,7 +57,7 @@ class CompanyController extends BaseController
protected $company_repo;
public $forced_includes = [];
public $forced_includes = [];
/**
* CompanyController constructor.
@ -466,14 +466,10 @@ class CompanyController extends BaseController
*/
public function destroy(DestroyCompanyRequest $request, Company $company)
{
info(print_r($request->all()));
info("destroying {$company->present()->name()} - {$company->hashed_id}");
$company_count = $company->account->companies->count();
$account = $company->account;
info("company count = {$company_count}");
if ($company_count == 1) {
$company->company_users->each(function ($company_user) {
@ -499,7 +495,9 @@ class CompanyController extends BaseController
$account->save();
}
}
// ob_flush();
return response()->json(['message' => 'success'], 200);
}
}

View File

@ -37,7 +37,7 @@ class Cors
$response->headers->set('Access-Control-Allow-Origin', '*');
$response->headers->set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
$response->headers->set('Access-Control-Allow-Headers', 'X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range');
$response->headers->set('Access-Control-Expose-Headers', 'X-APP-VERSION');
$response->headers->set('Access-Control-Expose-Headers', 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION');
$response->headers->set('X-APP-VERSION', config('ninja.app_version'));
$response->headers->set('X-MINIMUM-CLIENT-VERSION', config('ninja.minimum_client_version'));