Guillermo - add supported and allowed editable [skip ci]

This commit is contained in:
AntonyAntonio 2016-12-21 00:00:19 -03:00
parent d30d14d58b
commit 7f9c12df36
1 changed files with 19 additions and 0 deletions

View File

@ -36,6 +36,25 @@ class EditSettingsController extends Controller {
$settingInstance->store();
}
}
if(Controller::request('allowedLanguages') || Controller::request('supportedLanguages')) {
$this->handleLanguages();
}
Response::respondSuccess();
}
public function handleLanguages() {
$allowed = json_decode(Controller::request('allowedLanguages'));
$supported = json_decode(Controller::request('supportedLanguages'));
foreach(Language::LANGUAGES as $languageCode) {
$language = Language::getDataStore($languageCode, 'code');
$language->allowed = in_array($languageCode, $allowed);
$language->supported = in_array($languageCode, $supported);
$language->store();
}
}
}