41 lines
697 B
PHP
41 lines
697 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use App\Services\SmsService;
|
|
class SmsServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Bootstrap the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Register the application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->app->singleton('sms',function(){
|
|
|
|
return new SmsService();
|
|
|
|
});
|
|
|
|
//使用bind绑定实例到接口以便依赖注入
|
|
|
|
$this->app->bind('App\Contracts\SmsContract',function(){
|
|
|
|
return new SmsService();
|
|
|
|
});
|
|
}
|
|
}
|