public function postImport(Request $request) { $action = strtolower($request->get('replace', 'append')); $counter = 0; switch (true) { case 'append' === $action: case 'replace' === $action: $counter = $this->manager->importTranslations('append' !== $action); break; case 'truncate' === $action: $counter = $this->manager->truncateTranslations(); break; case 'clear' === $action: $counter = $this->manager->clearTranslations(); break; default: return redirect()->action('\\Simexis\\MultiLanguage\\Controllers\\MultilanguageController@getIndex')->with(['message' => Lang::get('multilanguage::multilanguage.errors.wrong_action'), 'type' => 'danger']); break; } return redirect()->action('\\Simexis\\MultiLanguage\\Controllers\\MultilanguageController@getIndex')->with(['message' => Lang::get('multilanguage::multilanguage.form_actions_messages.' . $action, ['counter' => is_numeric($counter) ? $counter : 0]), 'type' => 'info']); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules(Manager $manager) { $locale = $manager->findByLocale(Input::get(config('multilanguage.locale_key'))); return ['name' => 'required', config('multilanguage.locale_key') => 'required|alpha|size:2|unique:languages,' . config('multilanguage.locale_key') . ',' . ($locale ? $locale->id : 0)]; }