myvideogamelist.com/app/Http/Controllers/UserSiteSettingController.php

28 lines
682 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Http\Controllers;
use App\Models\UserSiteSetting;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class UserSiteSettingController extends Controller
{
/**
* Set the users dark mode setting.
*
* @param string $mode Dark mode setting, either 'yes' or 'no'.
* @return \Illuminate\Http\Response
*/
public static function setDarkMode($mode)
{
// Get the user as an object.
$user = auth()->user();
$result = DB::table('user_site_settings')->updateOrInsert(
['user_id' => $user->id, 'setting_name' => 'dark_mode'],
['setting_value' => $mode]
);
}
}