Esempio n. 1
0
 /**
  * Return true if users are allowed to change application language, false otherwise.
  *
  * @return bool
  */
 public static function changeLanguage()
 {
     $securitySetting = SecuritySetting::first();
     if ($securitySetting->allow_users_to_change_language) {
         return true;
     }
     return false;
 }
 /**
  * @param DenyUsersToChangeLanguageRequest $request
  * @return mixed
  */
 public function denyUsersToChangeLanguage(DenyUsersToChangeLanguageRequest $request)
 {
     $securitySetting = SecuritySetting::first();
     $securitySetting->allow_users_to_change_language = 0;
     $securitySetting->save();
     // Success response
     $response = new AjaxResponse();
     $response->setSuccessMessage(trans('application_settings.users_are_not_allowed_to_change_language'));
     $response->addExtraFields(['allow_users_to_change_language' => trans('common.no'), 'allow_users_to_change_language_bool' => false]);
     return response($response->get())->header('Content-Type', 'application/json');
 }