public function saveUserPref(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $msg = $this->app->trans('Error while saving preference');
        $prop = $request->request->get('prop');
        $value = $request->request->get('value');

        $success = false;
        if (null !== $prop && null !== $value) {
            $this->getUserManipulator()->setUserSetting($this->getAuthenticatedUser(), $prop, $value);
            $success = true;
            $msg = $this->app->trans('Preference saved !');
        }

        return new JsonResponse(['success' => $success, 'message' => $msg]);
    }
public function saveUserPref(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $msg = $this->app->trans('Error while saving preference');
        $prop = $request->request->get('prop');
        $value = $request->request->get('value');

        $success = false;
        if (null !== $prop && null !== $value) {
            $this->getUserManipulator()->setUserSetting($this->getAuthenticatedUser(), $prop, $value);
            $success = true;
            $msg = $this->app->trans('Preference saved !');
        }

        return new JsonResponse(['success' => $success, 'message' => $msg]);
    }
public function saveUserPref ( Request $ request ) { if ( ! $ request -> isXmlHttpRequest ( ) ) { $ this -> app -> abort ( 400 ) ; } $ msg = $ this -> app -> trans ( 'Error while saving preference' ) ; $ prop = $ request -> request -> get ( 'prop' ) ; $ value = $ request -> request -> get ( 'value' ) ; $ success = false ; if ( null !== $ prop && null !== $ value ) { $ this -> getUserManipulator ( ) -> setUserSetting ( $ this -> getAuthenticatedUser ( ) , $ prop , $ value ) ; $ success = true ; $ msg = $ this -> app -> trans ( 'Preference saved !' ) ; } return new JsonResponse ( [ 'success' => $ success , 'message' => $ msg ] ) ; }
Save user preferences

@param  Request $request
@return JsonResponse
Save user preferences