app\http\ViewComposers\TranslationComposer::compose PHP Method

compose() public method

Bind data to the view.
public compose ( Illuminate\View\View $view ) : void
$view Illuminate\View\View
return void
    public function compose(View $view)
    {
        $view->with('industries', Cache::get('industries')->each(function ($industry) {
            $industry->name = trans('texts.industry_' . $industry->name);
        })->sortBy(function ($industry) {
            return $industry->name;
        }));
        $view->with('countries', Cache::get('countries')->each(function ($country) {
            $country->name = trans('texts.country_' . $country->name);
        })->sortBy(function ($country) {
            return $country->name;
        }));
        $view->with('paymentTypes', Cache::get('paymentTypes')->each(function ($pType) {
            $pType->name = trans('texts.payment_type_' . $pType->name);
        })->sortBy(function ($pType) {
            return $pType->name;
        }));
        $view->with('languages', Cache::get('languages')->each(function ($lang) {
            $lang->name = trans('texts.lang_' . $lang->name);
        })->sortBy(function ($lang) {
            return $lang->name;
        }));
    }
TranslationComposer