singleton(Settings::class, function () { if (!($settings = Settings::find(1))) { throw new \ErrorException('Settings not found in DB'); } return $settings; }); if (!app()->runningInConsole()) { // On ramène le nom du jeu et le nom de la société sur toute les pages $settingsGlobal = Cache::get('settingsGlobal'); if (!$settingsGlobal) { $settingsGlobal = app(Settings::class)->select('name', 'company', 'analytics', 'start_date', 'end_date')->first(); Cache::put('settingsGlobal', $settingsGlobal); } View::share('settingsGlobal', $settingsGlobal); // On ramène aussi tout les prix car on en a besoin sur le header $prizesGlobal = Cache::get('prizesGlobal'); if (!$prizesGlobal) { $prizesGlobal = Prizes::all(); Cache::put('prizesGlobal', $prizesGlobal); } View::share('prizesGlobal', $prizesGlobal); Blade::if('superadmin', function () { return auth()->user() && auth()->user()->role == 1; }); } } }