Update SettingsController

This commit is contained in:
Daniel Supernault 2019-04-21 23:39:00 -06:00
parent fae385989e
commit f1edf83af4
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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);
}
}