pixelfed/app/Http/Controllers/SettingsController.php

88 lines
1.8 KiB
PHP
Raw Normal View History

2018-05-26 22:53:21 +00:00
<?php
namespace App\Http\Controllers;
2018-08-28 03:07:36 +00:00
use App\AccountLog;
2018-09-17 01:47:19 +00:00
2018-08-28 03:07:36 +00:00
use Auth;
use DB;
use Illuminate\Http\Request;
2018-09-17 01:47:19 +00:00
use App\Http\Controllers\Settings\{
HomeSettings,
PrivacySettings,
SecuritySettings
};
2018-05-26 22:53:21 +00:00
class SettingsController extends Controller
{
2018-09-17 01:47:19 +00:00
use HomeSettings,
PrivacySettings,
SecuritySettings;
2018-05-26 22:53:21 +00:00
public function __construct()
{
2018-08-10 03:17:24 +00:00
$this->middleware('auth');
2018-05-26 22:53:21 +00:00
}
public function accessibility()
{
2018-08-28 03:07:36 +00:00
$settings = Auth::user()->settings;
return view('settings.accessibility', compact('settings'));
}
public function accessibilityStore(Request $request)
{
2018-08-28 03:07:36 +00:00
$settings = Auth::user()->settings;
$fields = [
'compose_media_descriptions',
'reduce_motion',
'optimize_screen_reader',
'high_contrast_mode',
2018-08-28 03:07:36 +00:00
'video_autoplay',
];
2018-08-28 03:07:36 +00:00
foreach ($fields as $field) {
$form = $request->input($field);
if ($form == 'on') {
$settings->{$field} = true;
} else {
$settings->{$field} = false;
}
$settings->save();
}
return redirect(route('settings.accessibility'))->with('status', 'Settings successfully updated!');
}
2018-05-26 22:53:21 +00:00
public function notifications()
{
2018-08-28 03:07:36 +00:00
return view('settings.notifications');
2018-05-26 22:53:21 +00:00
}
public function applications()
{
2018-08-28 03:07:36 +00:00
return view('settings.applications');
2018-05-26 22:53:21 +00:00
}
public function dataExport()
{
2018-08-28 03:07:36 +00:00
return view('settings.dataexport');
2018-05-26 22:53:21 +00:00
}
public function dataImport()
{
2018-08-28 03:07:36 +00:00
return view('settings.import.home');
2018-05-26 22:53:21 +00:00
}
public function dataImportInstagram()
{
2018-08-28 03:07:36 +00:00
return view('settings.import.instagram.home');
2018-05-26 22:53:21 +00:00
}
public function developers()
{
2018-08-28 03:07:36 +00:00
return view('settings.developers');
2018-05-26 22:53:21 +00:00
}
}
2018-08-31 04:29:38 +00:00