48 lines
1.1 KiB
PHP
48 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Models\PersonalAccessToken;
|
|
use Illuminate\Pagination\Paginator;
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Laravel\Sanctum\Sanctum;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
Paginator::useBootstrapFive();
|
|
|
|
Sanctum::usePersonalAccessTokenModel(PersonalAccessToken::class);
|
|
|
|
Http::macro('module', function ($api_token, $url) {
|
|
// 关闭证书验证
|
|
return Http::baseUrl($url)
|
|
->withUserAgent('LAECloud-Client')
|
|
->withHeaders([
|
|
'X-Module-Api-Token' => $api_token,
|
|
])->withOptions([
|
|
'version' => 2,
|
|
]);
|
|
});
|
|
|
|
// Carbon::setTestNow(now()->addDays(1));
|
|
}
|
|
}
|