2015-12-06 13:58:49 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Providers;
|
|
|
|
|
2021-07-27 21:23:11 -07:00
|
|
|
use Laravel\Sanctum\Sanctum;
|
2021-08-07 16:10:24 -07:00
|
|
|
use Pterodactyl\Models\User;
|
2017-11-04 14:21:30 -05:00
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
use Pterodactyl\Models\Subuser;
|
2017-09-24 22:34:30 -05:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
2015-12-06 13:58:49 -05:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2017-11-04 14:21:30 -05:00
|
|
|
use Pterodactyl\Observers\UserObserver;
|
|
|
|
use Pterodactyl\Observers\ServerObserver;
|
|
|
|
use Pterodactyl\Observers\SubuserObserver;
|
2021-07-27 21:23:11 -07:00
|
|
|
use Pterodactyl\Models\PersonalAccessToken;
|
2015-12-06 13:58:49 -05:00
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2017-09-24 22:34:30 -05:00
|
|
|
Schema::defaultStringLength(191);
|
|
|
|
|
2017-11-04 14:21:30 -05:00
|
|
|
User::observe(UserObserver::class);
|
|
|
|
Server::observe(ServerObserver::class);
|
|
|
|
Subuser::observe(SubuserObserver::class);
|
2021-07-27 21:23:11 -07:00
|
|
|
|
2021-08-07 16:10:24 -07:00
|
|
|
/*
|
2021-07-27 21:23:11 -07:00
|
|
|
* @see https://laravel.com/docs/8.x/sanctum#overriding-default-models
|
|
|
|
*/
|
|
|
|
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|
|
|
|
|
2017-12-30 16:33:00 -06:00
|
|
|
/**
|
|
|
|
* Register application service providers.
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2021-07-28 20:53:54 -07:00
|
|
|
Sanctum::ignoreMigrations();
|
|
|
|
|
2017-12-30 16:33:00 -06:00
|
|
|
// Only load the settings service provider if the environment
|
|
|
|
// is configured to allow it.
|
2021-08-07 16:10:24 -07:00
|
|
|
if (!config('pterodactyl.load_environment_only', false) && $this->app->environment() !== 'testing') {
|
2017-12-30 16:33:00 -06:00
|
|
|
$this->app->register(SettingsServiceProvider::class);
|
|
|
|
}
|
2017-04-27 22:28:01 -04:00
|
|
|
}
|
2015-12-06 13:58:49 -05:00
|
|
|
}
|