From 0afd048c133459b9f53ddb8d8322ee9ecfbe79dd Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 4 May 2019 18:15:34 -0600 Subject: [PATCH] Update LabsSettings controller --- .../Controllers/Settings/LabsSettings.php | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Settings/LabsSettings.php b/app/Http/Controllers/Settings/LabsSettings.php index 8d6187fda..1d783e2f7 100644 --- a/app/Http/Controllers/Settings/LabsSettings.php +++ b/app/Http/Controllers/Settings/LabsSettings.php @@ -24,7 +24,8 @@ trait LabsSettings { $this->validate($request, [ 'profile_layout' => 'nullable', 'dark_mode' => 'nullable', - 'profile_suggestions' => 'nullable' + 'profile_suggestions' => 'nullable', + 'moment_bg' => 'nullable' ]); $changes = false; @@ -60,6 +61,12 @@ trait LabsSettings { SuggestionService::del($profile->id); } + if($request->has('moment_bg') && $profile->profile_layout == 'moment') { + $bg = in_array($request->input('moment_bg'), $this->momentBackgrounds()) ? $request->input('moment_bg') : 'default'; + $profile->header_bg = $bg; + $changes = true; + } + if($changes == true) { $profile->save(); } @@ -69,4 +76,21 @@ trait LabsSettings { ->cookie($cookie); } + protected function momentBackgrounds() + { + return [ + 'default', + 'azure', + 'passion', + 'reef', + 'lush', + 'neon', + 'flare', + 'morning', + 'tranquil', + 'mauve', + 'argon', + 'royal' + ]; + } } \ No newline at end of file