Skip to content

Commit be3151f

Browse files
committed
Break service provider apart, pass container through to the manager.
1 parent e2fedef commit be3151f

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

src/TorchlightServiceProvider.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,37 @@ class TorchlightServiceProvider extends ServiceProvider
1313
{
1414
public function boot()
1515
{
16-
$this->app->singleton(Manager::class);
16+
$this->bindManagerSingleton();
17+
$this->registerCommands();
18+
$this->publishConfig();
19+
$this->registerBladeComponent();
20+
}
1721

22+
public function bindManagerSingleton()
23+
{
24+
$this->app->singleton(Manager::class, function () {
25+
return new Manager($this->app);
26+
});
27+
}
28+
29+
public function registerCommands()
30+
{
1831
if ($this->app->runningInConsole()) {
1932
$this->commands([
2033
Install::class,
2134
]);
2235
}
36+
}
2337

38+
public function publishConfig()
39+
{
2440
$this->publishes([
2541
__DIR__ . '/../config/torchlight.php' => config_path('torchlight.php')
2642
], 'config');
43+
}
2744

45+
public function registerBladeComponent()
46+
{
2847
if (Torchlight::config('torchlight.blade_components')) {
2948
$this->loadViewComponentsAs('torchlight', [
3049
'code' => CodeComponent::class

0 commit comments

Comments
 (0)