myvideogamelist.com/app/Http/Controllers/UserSiteSettingController.php
Jimmy Brancaccio b39ecf1638 Initial Commit
The initial public commit of MVGL website code.
2024-01-14 13:51:43 -06:00

27 lines
682 B
PHP

<?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]
);
}
}