laravel官方文档
使用延迟加载的时候,需要配置defer属性和 providers 方法 , 但是没有搞东provides 方法怎么填写, 下面这样写可以吗? 没有报错,但是感觉文档不是这个意思
<?php
namespace App\Providers;
use App\Billing\Stripe;
use Illuminate\Support\ServiceProvider;
class BillServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$this->app->singleton('billing', function($app){
return new Stripe();
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [Stripe::class];
}
}