2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
2018-03-19 09:37:35 +08:00
|
|
|
|
2017-06-09 02:28:26 +08:00
|
|
|
namespace App\Providers;
|
|
|
|
|
2022-02-09 04:07:02 +08:00
|
|
|
use App\Notifications\Channels\Discord\DiscordWebhook;
|
2018-03-12 07:00:42 +08:00
|
|
|
use App\Services\ModuleService;
|
2021-03-19 21:22:03 +08:00
|
|
|
use App\Support\ThemeViewFinder;
|
2019-12-13 04:07:35 +08:00
|
|
|
use App\Support\Utils;
|
2021-03-05 06:08:51 +08:00
|
|
|
use Illuminate\Pagination\Paginator;
|
2022-02-09 04:07:02 +08:00
|
|
|
use Illuminate\Support\Facades\Notification;
|
2017-12-08 04:06:12 +08:00
|
|
|
use Illuminate\Support\Facades\Schema;
|
2019-11-27 22:19:20 +08:00
|
|
|
use Illuminate\Support\Facades\View;
|
2017-06-09 02:28:26 +08:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2017-06-11 07:27:19 +08:00
|
|
|
|
2017-06-09 02:28:26 +08:00
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
2018-03-11 23:55:20 +08:00
|
|
|
public function boot(): void
|
2017-06-09 02:28:26 +08:00
|
|
|
{
|
2017-12-08 04:06:12 +08:00
|
|
|
Schema::defaultStringLength(191);
|
2022-02-09 04:07:02 +08:00
|
|
|
|
2021-03-05 06:08:51 +08:00
|
|
|
Paginator::useBootstrap();
|
2018-03-12 07:00:42 +08:00
|
|
|
View::share('moduleSvc', app(ModuleService::class));
|
2022-02-09 04:07:02 +08:00
|
|
|
|
|
|
|
Notification::extend('discord_webhook', function ($app) {
|
|
|
|
return app(DiscordWebhook::class);
|
|
|
|
});
|
2017-06-09 02:28:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*/
|
2018-03-11 23:55:20 +08:00
|
|
|
public function register(): void
|
2017-06-09 02:28:26 +08:00
|
|
|
{
|
2021-03-19 21:22:03 +08:00
|
|
|
$this->app->singleton('view.finder', function ($app) {
|
|
|
|
return new ThemeViewFinder(
|
|
|
|
$app['files'],
|
|
|
|
$app['config']['view.paths'],
|
|
|
|
null
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2019-12-02 22:57:35 +08:00
|
|
|
// Only load the IDE helper if it's included and enabled
|
2019-12-10 04:26:30 +08:00
|
|
|
if (config('app.debug') === true) {
|
2018-08-27 02:51:47 +08:00
|
|
|
/* @noinspection NestedPositiveIfStatementsInspection */
|
2019-12-02 23:29:16 +08:00
|
|
|
/* @noinspection PhpFullyQualifiedNameUsageInspection */
|
|
|
|
if (class_exists(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class)) {
|
|
|
|
/* @noinspection PhpFullyQualifiedNameUsageInspection */
|
|
|
|
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
|
2018-03-26 05:19:24 +08:00
|
|
|
}
|
2019-12-12 01:57:18 +08:00
|
|
|
|
2019-12-13 04:07:35 +08:00
|
|
|
if (config('app.debug_toolbar') === true) {
|
|
|
|
Utils::enableDebugToolbar();
|
|
|
|
} else {
|
|
|
|
Utils::disableDebugToolbar();
|
2019-12-12 01:57:18 +08:00
|
|
|
}
|
2018-03-26 05:19:24 +08:00
|
|
|
}
|
2017-06-09 02:28:26 +08:00
|
|
|
}
|
|
|
|
}
|