2022-08-12 07:56:56 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
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-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
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
}
|
|
|
|
|
2022-11-06 11:28:22 +00:00
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
2022-08-12 07:56:56 +00:00
|
|
|
public function boot()
|
|
|
|
{
|
|
|
|
//
|
2022-08-19 09:51:52 +00:00
|
|
|
|
|
|
|
Http::macro('remote', function ($api_token, $url) {
|
2022-08-27 08:28:39 +00:00
|
|
|
// 关闭证书验证
|
|
|
|
return Http::withoutVerifying()->withHeaders([
|
2022-08-19 09:51:52 +00:00
|
|
|
'X-Remote-Api-Token' => $api_token,
|
2022-08-29 09:31:08 +00:00
|
|
|
'Content-Type' => 'application/json'
|
2022-10-04 10:34:23 +00:00
|
|
|
])->withOptions([
|
|
|
|
'version' => 2,
|
2022-08-19 09:51:52 +00:00
|
|
|
])->baseUrl($url);
|
|
|
|
});
|
2022-10-29 05:53:32 +00:00
|
|
|
}
|
2022-08-12 07:56:56 +00:00
|
|
|
}
|