validated(); $user = User::where('id', Auth::user()->getAuthIdentifier())->firstOrFail(); $user->checkword = $validated['checkword']; $user->save(); Auth::setUser($user); return response()->json(['success' => true]); } public function settings() { return view('user.settings', [ 'settings' => Auth::user()->getSettings(), ]); } public function storeSettings(SettingsRequest $request) { $validated = $request->validated(); $user = User::where('id', Auth::user()->getAuthIdentifier())->firstOrFail(); foreach ($validated as $name => $value) { $user->{$name} = $value; } $user->save(); Auth::setUser($user); $request->session()->flash('status', __('Settings saved!')); return redirect()->route('user.settings'); } }