Lae/app/Providers/AppServiceProvider.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2022-08-12 07:56:56 +00:00
<?php
namespace App\Providers;
2022-11-07 04:37:54 +00:00
use App\Models\PersonalAccessToken;
2022-11-14 10:37:09 +00:00
use Illuminate\Pagination\Paginator;
2022-08-19 09:51:52 +00:00
use Illuminate\Support\Facades\Http;
2022-10-29 05:53:32 +00:00
use Illuminate\Support\ServiceProvider;
2022-11-08 13:01:43 +00:00
use Laravel\Sanctum\Sanctum;
2022-10-30 02:29:59 +00:00
2022-08-12 07:56:56 +00:00
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
2023-01-02 11:00:38 +00:00
public function register(): void
2022-08-12 07:56:56 +00:00
{
//
2023-01-02 16:05:46 +00:00
2022-08-12 07:56:56 +00:00
}
2022-11-06 11:28:22 +00:00
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(): void
2022-08-12 07:56:56 +00:00
{
2022-11-14 10:37:09 +00:00
Paginator::useBootstrapFive();
2022-11-07 04:37:54 +00:00
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
2022-11-16 02:29:50 +00:00
Http::macro('module', function ($api_token, $url) {
2022-08-27 08:28:39 +00:00
// 关闭证书验证
2023-01-19 08:17:17 +00:00
return Http::baseUrl($url)
->withUserAgent('LAECloud-Client')
->withHeaders([
'X-Module-Api-Token' => $api_token,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
])->withOptions([
'version' => 2,
]);
2022-08-19 09:51:52 +00:00
});
// Carbon setTestNow
// Carbon::setTestNow(now()->addDays(1));
2022-10-29 05:53:32 +00:00
}
2022-08-12 07:56:56 +00:00
}