I want information about the system locale to be available in every view, so I could highlight whatever language is currently selected by a user. After some googling around, I've found the value-sharing issue addressed at the official documentation. However, after putting the code into boot()
like this:
class AppServiceProvider extends ServiceProvider{
public function boot(){
view()->share('locale', \Lang::getLocale());
}
}
the $locale
variable, when accessed in views, always holds the default system locale, not the currently selected one. Why?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire