/** * Bootstrap the application services. * * @return void */ public function boot() { // Database is now available. // Replace previous binding with an actual model instance. $this->app->singleton('language', function () { return \App\Language::detect()->apply(); }); }
/** * Register any application services. * * This service provider is a great spot to register your various container * bindings with the application. As you can see, we are registering our * "Registrar" implementation here. You can add your own bindings too! * * @return void */ public function register() { // Detect global language $this->app->singleton('language', function () { return \App\Language::detect(); }); // Load environment Specific Service Providers... switch ($this->app->environment()) { default: $providers = []; break; case 'local': $providers = ['Barryvdh\\Debugbar\\ServiceProvider', 'Stolz\\HtmlTidy\\ServiceProvider', 'Stolz\\SchemaSpy\\ServiceProvider']; break; case 'testing': $providers = ['Stolz\\HtmlTidy\\ServiceProvider']; break; } foreach ($providers as $provider) { $this->app->register($provider); } }