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')); Translatable::fallback( fallbackAny: true, ); $this->sharetoView(); } /** * Share Vars to view * * @return void */ private function sharetoView() { if (app()->runningInConsole()) { return; } // * 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::useBootstrap(); } // * 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::defaultview('bo.modules.pagination'); } else { Paginator::defaultview('fo.modules.pagination'); } $appInfos = Cache::remember('composer', 360, function () { return json_decode(File::get(\app_path('../composer.json'))); }); // Share composer.json infos. if ( isset($appInfos->name) and isset($appInfos->version) and isset($appInfos->license) and isset($appInfos->time) ) { View::share('cpsr_name', $appInfos->name); View::share('cpsr_version', $appInfos->version); View::share('cpsr_license', $appInfos->license); View::share('cpsr_time', now()->parse($appInfos->time)->isoFormat('Y')); } View::share('globalHome', Home::query()->first()); View::share('conceptListGlobal', Concept::getCached()); } }