diff --git a/app/Http/Controllers/Migration/StepsController.php b/app/Http/Controllers/Migration/StepsController.php index 43ba0430853f..788b83f43601 100644 --- a/app/Http/Controllers/Migration/StepsController.php +++ b/app/Http/Controllers/Migration/StepsController.php @@ -155,11 +155,12 @@ class StepsController extends BaseController return redirect($this->access['companies']['redirect']); foreach ($request->companies as $company) { - $completeService = (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN'))) + (new CompleteService(session('MIGRATION_ACCOUNT_TOKEN'))) ->file($this->getMigrationFile()) ->force(array_key_exists('force', $company)) ->company($company['id']) ->endpoint(session('MIGRATION_ENDPOINT')) + ->companyKey($company['key']) ->start(); } @@ -223,7 +224,7 @@ class StepsController extends BaseController 'client_gateway_tokens' => $this->getClientGatewayTokens(), ]; - $file = storage_path("{$fileName}.zip"); + $file = storage_path("migrations/{$fileName}.zip"); $zip = new \ZipArchive(); $zip->open($file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE); diff --git a/app/Services/Migration/CompleteService.php b/app/Services/Migration/CompleteService.php index 959714df1b89..4b2e315ab362 100644 --- a/app/Services/Migration/CompleteService.php +++ b/app/Services/Migration/CompleteService.php @@ -16,7 +16,7 @@ class CompleteService protected $errors = []; protected $isSuccessful; protected $force = false; - + protected $companyKey; public function __construct(string $token) { @@ -51,11 +51,19 @@ class CompleteService return $this; } + public function companyKey(string $key) + { + $this->companyKey = $key; + + return $this; + } + public function start() { $body = [ 'migration' => \Unirest\Request\Body::file($this->file, 'application/zip'), 'force' => $this->force, + 'company_key' => $this->companyKey, ]; $response = Request::post($this->getUrl(), $this->getHeaders(), $body); diff --git a/resources/views/migration/companies.blade.php b/resources/views/migration/companies.blade.php index 19c8b9374303..141a3605fba3 100644 --- a/resources/views/migration/companies.blade.php +++ b/resources/views/migration/companies.blade.php @@ -24,6 +24,7 @@
+ * All current company data will be wiped.
diff --git a/resources/views/migration/start.blade.php b/resources/views/migration/start.blade.php index 40f7017964d4..543d5ea14983 100644 --- a/resources/views/migration/start.blade.php +++ b/resources/views/migration/start.blade.php @@ -12,15 +12,15 @@

In order to start the migration, we need to know where do you want to migrate.


{{ csrf_field() }} -
+
- +