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