You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
62 lines
1.4 KiB
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\HisSoap\Client;
|
|
use Illuminate\Support\Facades\Route;
|
|
use Illuminate\Routing\UrlGenerator;
|
|
use Illuminate\Support\Facades\Schema;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->cross();
|
|
$this->registerHisService();
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @param UrlGenerator $url
|
|
* @return void
|
|
*/
|
|
public function boot(UrlGenerator $url): void
|
|
{
|
|
Schema::defaultStringLength(191);
|
|
|
|
// Route参数表正则绑定
|
|
Route::pattern('patient_id', '[0-9]+');
|
|
Route::pattern('serial_no', '[0-9]+');
|
|
|
|
// 配置https
|
|
if(env('REDIRECT_HTTPS')) {
|
|
$url->forceScheme('https');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 允许跨域
|
|
* @return void
|
|
*/
|
|
protected function cross(): void
|
|
{
|
|
header("Access-Control-Allow-Origin: *");
|
|
header("Access-Control-Allow-Methods: GET,PUT,POST,PATCH,DELETE");
|
|
header('Access-Control-Allow-Headers:x-requested-with,content-type,Authorization');
|
|
}
|
|
|
|
protected function registerHisService(): void
|
|
{
|
|
// His平台服务
|
|
$this->app->singleton('HisSoapService', function () {
|
|
return new Client();
|
|
});
|
|
}
|
|
}
|
|
|