diff --git a/app/Http/Controllers/ImportJsonController.php b/app/Http/Controllers/ImportJsonController.php index bfdf1cfe29ed..f509dbc53e61 100644 --- a/app/Http/Controllers/ImportJsonController.php +++ b/app/Http/Controllers/ImportJsonController.php @@ -66,7 +66,8 @@ class ImportJsonController extends BaseController $file_location = $request->file('files') ->storeAs( 'migrations', - $request->file('files')->getClientOriginalName() + $request->file('files')->getClientOriginalName(), + config('filesystems.default'), ); if(Ninja::isHosted()) diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index 591c03bf33f5..17017722a2ab 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -224,7 +224,7 @@ class CompanyImport implements ShouldQueue // if(mime_content_type(Storage::path($this->file_location)) == 'text/plain') // return Storage::path($this->file_location); - $path = TempFile::filePath(Storage::get($this->file_location), basename($this->file_location)); + $path = TempFile::filePath(Storage::disk(config('filesystems.default'))->get($this->file_location), basename($this->file_location)); $zip = new ZipArchive(); $archive = $zip->open($path); @@ -235,7 +235,7 @@ class CompanyImport implements ShouldQueue $zip->close(); $file_location = "{$file_path}/backup.json"; - if (! file_exists($file_location)) + if (! file_exists($file_path)) throw new NonExistingMigrationFile('Backup file does not exist, or is corrupted.'); return $file_location; @@ -568,7 +568,7 @@ class CompanyImport implements ShouldQueue { $this->genericImport(GroupSetting::class, - ['user_id', 'company_id', 'id', 'hashed_id',], + ['user_id', 'company_id', 'id', 'hashed_id'], [['users' => 'user_id']], 'group_settings', 'name'); @@ -580,7 +580,7 @@ class CompanyImport implements ShouldQueue { $this->genericImport(Subscription::class, - ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id',], + ['user_id', 'assigned_user_id', 'company_id', 'id', 'hashed_id'], [['group_settings' => 'group_id'], ['users' => 'user_id'], ['users' => 'assigned_user_id']], 'subscriptions', 'name'); diff --git a/app/Models/GroupSetting.php b/app/Models/GroupSetting.php index fd6bb52bf67a..5fe53afdac76 100644 --- a/app/Models/GroupSetting.php +++ b/app/Models/GroupSetting.php @@ -34,6 +34,15 @@ class GroupSetting extends StaticModel 'settings', ]; + protected $appends = [ + 'hashed_id', + ]; + + public function getHashedIdAttribute() + { + return $this->encodePrimaryKey($this->id); + } + protected $touches = []; public function company()