40 lines
804 B
PHP
40 lines
804 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
//
|
|
|
|
Http::macro('remote', function ($api_token, $url) {
|
|
// 关闭证书验证
|
|
return Http::withoutVerifying()->withHeaders([
|
|
'X-Remote-Api-Token' => $api_token,
|
|
'Content-Type' => 'application/json'
|
|
])->withOptions([
|
|
'version' => 2,
|
|
])->baseUrl($url);
|
|
});
|
|
}
|
|
}
|