Tweak booting plugins

This commit is contained in:
Pig Fang 2019-08-19 16:52:10 +08:00
parent d51374fe99
commit 5fa956dfb6

View File

@ -132,7 +132,11 @@ class PluginManager
return; return;
} }
$this->getEnabledPlugins()->each(function ($plugin) { $enabled = $this->getEnabledPlugins();
$enabled->each(function ($plugin) {
$this->registerPlugin($plugin);
});
$enabled->each(function ($plugin) {
$this->bootPlugin($plugin); $this->bootPlugin($plugin);
}); });
$this->registerLifecycleHooks(); $this->registerLifecycleHooks();
@ -141,13 +145,20 @@ class PluginManager
} }
/** /**
* Boot one plugin. * Register resources of a plugin.
*/ */
public function bootPlugin(Plugin $plugin) public function registerPlugin(Plugin $plugin)
{ {
$this->registerAutoload($plugin); $this->registerAutoload($plugin);
$this->loadVendor($plugin); $this->loadVendor($plugin);
$this->loadViewsAndTranslations($plugin); $this->loadViewsAndTranslations($plugin);
}
/**
* Boot a plugin.
*/
public function bootPlugin(Plugin $plugin)
{
$this->registerServiceProviders($plugin); $this->registerServiceProviders($plugin);
$this->loadBootstrapper($plugin); $this->loadBootstrapper($plugin);
} }