getClientIp(); } else { return request()->server('HTTP_X_FORWARDED_FOR') ?? request()->getClientIp(); } }); // * LOCAL FORCE eg: for Carbon setlocale(LC_ALL, \sprintf( '%s_%s.UTF-8', config('app.locale'), \strtoupper(config('app.locale')) )); Carbon::setLocale(config('app.locale')); if (!app()->runningInConsole()) { // * FORCE BOOTSTRAP PAGINATOR (or custom if in front) // Early boot, request wont be filled as expected. if (collect(explode('/', \request()->getPathInfo()))->get(1) === 'bo') { Paginator::useBootstrap(); } else { Paginator::defaultView('front.modules.paginator'); } } $this->sharetoView(); if (Schema::hasTable('ranges')) { // On partage les ranges (gammes produit). $ranges = Range::where('status', true)->get(); View::share('published_ranges', $ranges); } if (Schema::hasTable('tags')) { // On partage les tags. $tags = Tag::where('status', true)->orderBy('order', 'ASC')->get(); View::share('published_tags', $tags); } Blade::directive('fmt_sellunit', function ($expression) { if (config('bosettings.sell_unit_management') == "strict") { return "label); } ?>"; } else { return ""; } }); Blade::directive('excerpt_product_title', function ($expression) { $limit = config('theme.max_product_title_length'); return ""; }); } /** * Share Vars to view * * @return void */ private function sharetoView() { // * View shares if (!app()->runningInConsole()) { $appInfos = Cache::remember('composer', 360, function () { return json_decode(File::get(\app_path('../composer.json'))); }); // Share composer.json infos . View::share('name', $appInfos->name); View::share('version', $appInfos->version); View::share('license', $appInfos->license); try { View::share('GeneralConfigGlobal', GeneralConfig::getCachedConfigs()); } catch (\Exception $e) { report($e); View::share('GeneralConfigGlobal', collect()); } //end try } //end if } }