diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php new file mode 100644 index 0000000..2bc6591 --- /dev/null +++ b/src/Console/InstallCommand.php @@ -0,0 +1,17 @@ +call('vendor:publish', ['--tag' => 'livewire-charts:public']); + } +} diff --git a/src/LivewireChartsServiceProvider.php b/src/LivewireChartsServiceProvider.php index 63de245..ee930de 100755 --- a/src/LivewireChartsServiceProvider.php +++ b/src/LivewireChartsServiceProvider.php @@ -7,6 +7,7 @@ use Asantibanez\LivewireCharts\Charts\LivewireColumnChart; use Asantibanez\LivewireCharts\Charts\LivewireLineChart; use Asantibanez\LivewireCharts\Charts\LivewirePieChart; use Asantibanez\LivewireCharts\Charts\LivewireRadarChart; +use Asantibanez\LivewireCharts\Console\InstallCommand; use Illuminate\Support\Facades\Blade; use Illuminate\Support\ServiceProvider; use Livewire\Livewire; @@ -15,7 +16,9 @@ class LivewireChartsServiceProvider extends ServiceProvider { public function boot() { - $this->registerViews(); + $this->registerCommands(); + + $this->registerViews(); $this->registerPublishables(); @@ -29,6 +32,16 @@ class LivewireChartsServiceProvider extends ServiceProvider $this->app->bind('livewirecharts', LivewireCharts::class); } + private function registerCommands() + { + if ($this->app->runningInConsole()) { + $this->commands([ + InstallCommand::class, + ]); + } + } + + private function registerViews() { $this->loadViewsFrom(__DIR__.'/../resources/views', 'livewire-charts');