43 lines
892 B
PHP
43 lines
892 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Iot\Linkos\HttpClient as LinkosHttpClient;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->registerLinkos();
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
\Schema::defaultStringLength(191);
|
|
}
|
|
|
|
/**
|
|
* 注册 Linkos 服务
|
|
*/
|
|
protected function registerLinkos(): void
|
|
{
|
|
$this->app->singleton(LinkosHttpClient::class, function ($app) {
|
|
return new LinkosHttpClient(
|
|
(string) $app['config']->get('services.linkos.key'),
|
|
(string) $app['config']->get('services.linkos.secret')
|
|
);
|
|
});
|
|
}
|
|
}
|