Lae/app/Providers/AppServiceProvider.php

39 lines
743 B
PHP
Raw Normal View History

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-08-12 07:56:56 +00:00
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()
{
//
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-08-19 09:51:52 +00:00
])->baseUrl($url);
});
2022-08-12 07:56:56 +00:00
}
}