name) and isset($appInfos->version)) { View::share('cpsr_name', $appInfos->name); View::share('cpsr_version', $appInfos->version); } if (!app()->runningInConsole()) { // * FORCE BOOTSTRAP PAGINATOR (or custom if in front) // Early boot, request wont be filled as expected. (collect(explode('/', \request()->getPathInfo()))->get(1) === 'bo') ? Paginator::defaultView('bo.modules.pagination') : Paginator::useBootstrapFive(); // * Inject actual view name View::composer('*', function ($view) { $view->with('viewName', $view->getName()); }); Blade::directive('money', function (string $amountVariable) { // phpcs:ignore Generic.Files.LineLength.TooLong return "format(new Money({$amountVariable}, app('phpMoneyCurrency')))); ?>"; }); // * Inject menuNodeList View::share('menuNodeList', (function () { /** @var \Illuminate\Database\Eloquent\Collection */ $settings = app('settings'); $mainMenu = $settings->where('type', SettingsType::mainMenu)->first(); if (!$mainMenu) { throw new \RuntimeException('Missing setting ' . SettingsType::mainMenu->label()); } return $mainMenu->value; })()); View::share('menuNodeDataList', app('menuNodeDataList')); // * Inject configuration model collect([ ['name' => 'mainMenuSettingModel', 'enum' => SettingsType::mainMenu], ['name' => 'hotNewsSettingModel', 'enum' => SettingsType::hotNews], ])->map(function ($array) { View::share($array['name'], (function () use ($array) { return GeneralSetting::query()->where('type', $array['enum'])->first() ?: null; })()); }); // * Inject some data for the bo menu. collect([ ['name' => 'firstMeat', 'value' => Meat::query()->first()], ['name' => 'firstRange', 'value' => Range::query()->first()], ['name' => 'mainMenuRangeModels', 'value' => Range::query()->orderBy('slug', 'ASC') ->where('published', true)->get()], ['name' => 'mainMenuMeatModels', 'value' => Meat::query()->orderBy('slug', 'ASC') ->where('published', true)->get()], ['name' => 'homeStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::home)->first()], ['name' => 'storyStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::story)->first()], ['name' => 'recruitmentStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::recruitment)->first()], ['name' => 'sagaStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::saga)->first()], ['name' => 'recipesStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::recipes)->first()], ['name' => 'recipeStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::recipe)->first()], ['name' => 'productsStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::products)->first()], ['name' => 'legalsStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::legals)->first()], ['name' => 'confidentialityStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::confidentiality)->first()], ['name' => 'sellingStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::selling)->first()], ['name' => 'accessibilityStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::accessibility)->first()], ['name' => 'productStaticPageModel', 'value' => StaticPage::query() ->where('type', StaticPageType::product)->first()], ])->map(function ($array) { View::share($array['name'], (function () use ($array) { return $array['value'] ?: null; })()); }); } //end if } }