From 8dbd4b536ca7382a77e8df0dcb65ba27ffbd76ee Mon Sep 17 00:00:00 2001 From: Alexis Saettler Date: Sat, 22 Sep 2018 13:33:37 +0200 Subject: [PATCH] fix: fix sql export (#1832) --- app/Http/Controllers/SettingsController.php | 2 +- app/Jobs/ExportAccountAsSQL.php | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 25d9d167e..69002662f 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -216,7 +216,7 @@ class SettingsController extends Controller $path = $this->dispatchNow(new ExportAccountAsSQL()); return response() - ->download(Storage::disk('public')->getDriver()->getAdapter()->getPathPrefix().$path, 'monica.sql') + ->download(Storage::disk(ExportAccountAsSQL::STORAGE)->getDriver()->getAdapter()->getPathPrefix().$path, 'monica.sql') ->deleteFileAfterSend(true); } diff --git a/app/Jobs/ExportAccountAsSQL.php b/app/Jobs/ExportAccountAsSQL.php index a235c0ef4..bbc1bfb2a 100644 --- a/app/Jobs/ExportAccountAsSQL.php +++ b/app/Jobs/ExportAccountAsSQL.php @@ -54,6 +54,12 @@ class ExportAccountAsSQL protected $file = ''; protected $path = ''; + /** + * Storage disk used to store the exported file. + * @var string + */ + public const STORAGE = 'public'; + /** * Create a new job instance. * @@ -153,7 +159,7 @@ class ExportAccountAsSQL $sql .= $newSQLLine; } - Storage::disk(config('filesystems.default'))->put($downloadPath, $sql); + Storage::disk(self::STORAGE)->put($downloadPath, $sql); return $downloadPath; }