public function getTranslations($filename, $languageCode) { if (!in_array($languageCode, $this->languageCodes)) { \App::abort(404, 'Given language not found.'); } $fileLabels = $this->translationService->getFileLabels($filename); if (!$fileLabels) { \App::abort(404, 'The given file not found.'); } $translationLabels = TranslationLabelQuery::create()->filterByFilename($filename)->filterByLanguageCode($languageCode)->find(); $keyToTranslationLabel = []; foreach ($translationLabels as $translationLabel) { $keyToTranslationLabel[$translationLabel->getKey()] = $translationLabel; } $keyToValue = $translationLabels->toKeyValue('key', 'value'); $defaultValues = Utility::toInputNames($keyToValue); $keyToTranslationLabel = Utility::toInputNames($keyToTranslationLabel); if (!$defaultValues) { \App::abort(404, 'The given file not found.'); } return View::make('translation.form', compact('file', 'fileLabels', 'defaultValues', 'filename', 'keyToTranslationLabel')); }