How Laravel workbech package can auto boot another workbench package?

*爱你&永不变心* 提交于 2019-12-11 02:12:13

问题


In Laravel 4 I'm developing 2 distinct workbench packages at the same time. Packages work in conjunction but I want to keep things separated. When they will be ready, the second will depend on the first one through Composer and everything will run well (hope so)... but now: How to make the first ServiceProvider auto boot the second ServiceProvider without writing two lines in /app/config/app.php ??

Now they work great adding two lines into 'providers' in /app/config/app.php but I just want to add one line to keep things easier. Thanks


回答1:


You can call the register method to do this, directly in your service provider.

$this->app->register('YourServiceProvider');

If you wish to call the register method outside a service provider, you will need to use the App Facade.

App::register('YourServiceProvider');


来源:https://stackoverflow.com/questions/18982603/how-laravel-workbech-package-can-auto-boot-another-workbench-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!