public function getView($locale, $group)
 {
     $locale = $this->manager->findByLocale($locale);
     if (!$locale) {
         return redirect()->action('\\Simexis\\MultiLanguage\\Controllers\\MultilanguageController@getIndex')->with(['message' => Lang::get('multilanguage::multilanguage.errors.language_not_found'), 'type' => 'danger']);
     }
     $locales = $this->manager->getLocales();
     $groups = $this->manager->getGroups(config('multilanguage.exclude_groups'));
     $allTranslations = $this->manager->getItems($group);
     $defaults = $this->manager->loadDefault($group);
     $numTranslations = $allTranslations->where(config('multilanguage.locale_key'), config('multilanguage.locale'))->count();
     $numChanged = $allTranslations->where(config('multilanguage.locale_key'), $locale->{config('multilanguage.locale_key')})->where('locked', Manager::LOCKED)->count();
     $translations = $this->manager->makeTree($allTranslations);
     return view('multilanguage::group_edit')->with('translations', $translations)->with('locales', $locales)->with('locale', $locale)->with('groups', $groups)->with('defaults', $defaults)->with('group', $group)->with('numTranslations', $numTranslations)->with('numChanged', $numChanged)->with('editUrl', action('\\Simexis\\MultiLanguage\\Controllers\\MultilanguageController@postEdit', [$group]));
 }
Exemplo n.º 2
0
 /**
  * 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)];
 }