Language editor refactoring part 4 (backend + frontend)

This commit is contained in:
Peter Papp
2021-04-01 10:40:48 +02:00
parent 5130082111
commit 7772ef6b40
32 changed files with 288 additions and 161 deletions

View File

@@ -164,17 +164,10 @@ class AppFunctionsController extends Controller
*/
public function get_storage_plans()
{
if (Cache::has('pricing')) {
// Get pricing from cache
$pricing = Cache::get('pricing');
} else {
// Store pricing to cache
$pricing = Cache::rememberForever('pricing', function () {
return $this->stripe->getActivePlans();
});
}
// Get pricing from cache
$pricing = Cache::rememberForever('pricing', function () {
return $this->stripe->getActivePlans();
});
// Format pricing to collection
$collection = new PricingCollection($pricing);
@@ -194,11 +187,10 @@ class AppFunctionsController extends Controller
*/
public function get_translations($lang)
{
$translations = Cache::rememberForever("language-strings-$lang", function () use ($lang) {
$translations = Cache::rememberForever("language-translations-$lang", function () use ($lang) {
return Language::whereLocale($lang)
->firstOrFail()
->languageStrings;
->languageTranslations;
});
return map_language_translations($translations);