| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Providers;
- use App\Notification\DingDingRobot;
- use Illuminate\Pagination\Paginator;
- use Illuminate\Support\Facades\Schema;
- use Illuminate\Support\ServiceProvider;
- class AppServiceProvider extends ServiceProvider
- {
- /**
- * Bootstrap any application services.
- *
- * @return void
- */
- public function boot()
- {
- //
- Schema::defaultStringLength(191);
- // Laravel 5.7兼容的分页设置
- Paginator::defaultView('vendor.pagination.bootstrap-4');
- Paginator::defaultSimpleView('vendor.pagination.simple-bootstrap-4');
- }
- /**
- * Register any application services.
- *
- * @return void
- */
- public function register()
- {
- $this->app->singleton(DingDingRobot::class, function () {
- return new DingDingRobot(env('DINGDING_ACCESS_TOKEN'), env('DINGDING_SECRET'));
- });
- // 仅在测试环境使用信任自签名证书的 SQL Server 连接器 (兼容 ODBC Driver 18)
- if (env('APP_ENV') === 'testing') {
- $this->app->singleton('db.factory', function ($app) {
- return new \App\Connectors\TrustConnectionFactory($app);
- });
- }
- }
- }
|