mirror of
https://github.com/ProxyPanel/ProxyPanel.git
synced 2026-04-11 23:19:05 +00:00
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\Config;
|
|
use App\Models\Node;
|
|
use App\Models\Order;
|
|
use App\Models\User;
|
|
use App\Models\UserGroup;
|
|
use App\Observers\ConfigObserver;
|
|
use App\Observers\NodeObserver;
|
|
use App\Observers\OrderObserver;
|
|
use App\Observers\UserGroupObserver;
|
|
use App\Observers\UserObserver;
|
|
use DB;
|
|
use File;
|
|
use Illuminate\Pagination\Paginator;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Schema;
|
|
use URL;
|
|
|
|
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);
|
|
}
|
|
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');
|
|
}
|
|
|
|
Config::observe(ConfigObserver::class);
|
|
Node::observe(NodeObserver::class);
|
|
Order::observe(OrderObserver::class);
|
|
UserGroup::observe(UserGroupObserver::class);
|
|
User::observe(UserObserver::class);
|
|
}
|
|
}
|