| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Providers;
- use DB;
- use File;
- use Illuminate\Pagination\Paginator;
- use Illuminate\Support\ServiceProvider;
- use Schema;
- use URL;
- use function config;
- class AppServiceProvider extends ServiceProvider
- {
- /**
- * Register any application services.
- */
- public function register(): void
- {
- if ($this->app->isLocal() && config('app.debug')) {
- $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
- $this->app->register(TelescopeServiceProvider::class);
- $this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
- $this->app->register(\Barryvdh\Debugbar\ServiceProvider::class);
- }
- if (File::exists(base_path().'/.env') && Schema::hasTable('config') && DB::table('config')->exists()) {
- $this->app->register(SettingServiceProvider::class);
- }
- }
- /**
- * Bootstrap any application services.
- */
- public function boot(): void
- {
- Paginator::useBootstrap();
- // 检测是否强制跳转https
- if (config('session.secure')) {
- URL::forceScheme('https');
- }
- }
- }
|