- protected UserRepo $userRepo;
-
- public function __construct(UserRepo $userRepo)
- {
- $this->userRepo = $userRepo;
- }
-
- /**
- * Show the user-specific interface shortcuts.
- */
- public function showShortcuts()
- {
- $shortcuts = UserShortcutMap::fromUserPreferences();
- $enabled = setting()->getForCurrentUser('ui-shortcuts-enabled', false);
-
- return view('users.preferences.shortcuts', [
- 'shortcuts' => $shortcuts,
- 'enabled' => $enabled,
- ]);
- }
-
- /**
- * Update the user-specific interface shortcuts.
- */
- public function updateShortcuts(Request $request)
- {
- $enabled = $request->get('enabled') === 'true';
- $providedShortcuts = $request->get('shortcut', []);
- $shortcuts = new UserShortcutMap($providedShortcuts);
-
- setting()->putForCurrentUser('ui-shortcuts', $shortcuts->toJson());
- setting()->putForCurrentUser('ui-shortcuts-enabled', $enabled);
-
- $this->showSuccessNotification(trans('preferences.shortcuts_update_success'));
-
- return redirect('/preferences/shortcuts');