From dffb9be1893f865bb3c2560ac1e24d246cc51a83 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 14 Aug 2020 10:40:59 +1000 Subject: [PATCH] Fixes for purge company and preserve settings --- app/Http/Controllers/MigrationController.php | 5 +++-- app/Models/Company.php | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 2a717fb4c6..955e4b3b7a 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -143,9 +143,10 @@ class MigrationController extends BaseController * ), * ) */ - public function purgeCompanySaveSettings(Company $company) + public function purgeCompanySaveSettings(Request $request, Company $company) { - $company->client->delete(); + + $company->clients()->delete(); $company->save(); return response()->json(['message' => 'Settings preserved'], 200); diff --git a/app/Models/Company.php b/app/Models/Company.php index a8c3fa440f..d54f712a93 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -411,8 +411,7 @@ class Company extends BaseModel public function resolveRouteBinding($value) { - return $this - ->where('id', $this->decodePrimaryKey($value))->firstOrFail(); + return $this->where('id', $this->decodePrimaryKey($value))->firstOrFail(); } public function domain() @@ -445,4 +444,5 @@ class Company extends BaseModel } } + }