/** * Bind data to the view. * * @param View $view */ public function compose(View $view) { $view->with(['localized' => $this->repository->isLocalized(), 'currentLocale' => app()->getLocale(), 'availableLocales' => $this->repository->getAvailable()]); }
/** * @param \Illuminate\Http\Request $request * @return string */ protected function getRequestLocale($request) { $locales = array_unique(array_merge([$this->repository->getDefault()], $this->repository->getAvailable())); return $request->getPreferredLanguage($locales); }