From 202591954d8bbd1efd9cfc362e3408233a8d4596 Mon Sep 17 00:00:00 2001 From: asantibanez Date: Mon, 14 Feb 2022 12:49:36 -0500 Subject: [PATCH] Added install command --- src/Console/InstallCommand.php | 17 +++++++++++++++++ src/LivewireChartsServiceProvider.php | 15 ++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/Console/InstallCommand.php 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');