Answer the question
In order to leave comments, you need to log in
How to make Laravel 5 trigger locale switching in AppServiceProvider.php?
Hello dear people!
I am interested in one interesting thing in Laravel 5. In the structure of the framework in the Http / Providers folder there is AppServiceProvider.php, in the boot method I write
public function boot()
{
View::share('news_category', NewsCategory::all());
}
private $locale;
public function __construct()
{
$this->locale = LaravelLocalization::getCurrentLocale();
}
public function getNameAttribute()
{
$column = "name_" . $this->locale;
return $this->{$column};
}
Answer the question
In order to leave comments, you need to log in
Understood this issue. Everything turns out to be simply solved with the help of composers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question