From f1edf83af4f58ab52d099e1fe8afa75f75eab0c8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 21 Apr 2019 23:39:00 -0600 Subject: [PATCH] Update SettingsController --- app/Http/Controllers/SettingsController.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 66f684164..264ab3939 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -6,7 +6,7 @@ use App\AccountLog; use App\Following; use App\Report; use App\UserFilter; -use Auth, DB, Cache, Purify; +use Auth, Cookie, DB, Cache, Purify; use Carbon\Carbon; use Illuminate\Http\Request; use App\Http\Controllers\Settings\{ @@ -176,7 +176,7 @@ class SettingsController extends Controller $profile->save(); Cache::forget('profiles:private'); Auth::logout(); - DeleteAccountPipeline::dispatch($user); + DeleteAccountPipeline::dispatch($user)->onQueue('high'); return redirect('/'); } @@ -192,5 +192,22 @@ class SettingsController extends Controller $reports = Report::whereProfileId($profile->id)->orderByDesc('created_at')->paginate(10); return view('settings.reports', compact('reports')); } + + public function metroDarkMode(Request $request) + { + $this->validate($request, [ + 'mode' => 'required|string|in:light,dark' + ]); + + $mode = $request->input('mode'); + + if($mode == 'dark') { + $cookie = Cookie::make('dark-mode', true, 43800); + } else { + $cookie = Cookie::forget('dark-mode'); + } + + return response()->json([200])->cookie($cookie); + } }