From 04d19295ed1a54bf025141996bfbe139a4d47e6d Mon Sep 17 00:00:00 2001 From: asantibanez Date: Wed, 3 Jun 2020 17:51:19 -0500 Subject: [PATCH] Added scripts and blade tag --- src/LivewireSelect.php | 2 +- src/LivewireSelectServiceProvider.php | 46 ++++++++++----------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/LivewireSelect.php b/src/LivewireSelect.php index de01170..ba92077 100755 --- a/src/LivewireSelect.php +++ b/src/LivewireSelect.php @@ -128,7 +128,7 @@ public function selectValue($value) $this->value = $value; if ($this->searchable && $this->value == null) { - $this->emit("focus-search", ['name' => $this->name]); + $this->emit('livewire-select-focus-search', ['name' => $this->name]); } $this->notifyValueChanged(); diff --git a/src/LivewireSelectServiceProvider.php b/src/LivewireSelectServiceProvider.php index 0aab5ee..7421c45 100755 --- a/src/LivewireSelectServiceProvider.php +++ b/src/LivewireSelectServiceProvider.php @@ -12,36 +12,12 @@ class LivewireSelectServiceProvider extends ServiceProvider */ public function boot() { - /* - * Optional methods to load your package assets - */ - // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'livewire-select'); - $this->loadViewsFrom(__DIR__.'/../resources/views', 'livewire-select'); - // $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); - // $this->loadRoutesFrom(__DIR__.'/routes.php'); + $this->loadViewsFrom(__DIR__.'/../resources/views', 'livewire-select'); if ($this->app->runningInConsole()) { $this->publishes([ - __DIR__.'/../config/config.php' => config_path('livewire-select.php'), - ], 'config'); - - // Publishing the views. - /*$this->publishes([ __DIR__.'/../resources/views' => resource_path('views/vendor/livewire-select'), - ], 'views');*/ - - // Publishing assets. - /*$this->publishes([ - __DIR__.'/../resources/assets' => public_path('vendor/livewire-select'), - ], 'assets');*/ - - // Publishing the translation files. - /*$this->publishes([ - __DIR__.'/../resources/lang' => resource_path('lang/vendor/livewire-select'), - ], 'lang');*/ - - // Registering package commands. - // $this->commands([]); + ], 'livewire-select-views'); } } @@ -50,12 +26,22 @@ public function boot() */ public function register() { - // Automatically apply the package configuration $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'livewire-select'); - // Register the main class to use with the facade - $this->app->singleton('livewire-select', function () { - return new LivewireSelect; + Blade::directive('livewireSelectScripts', function () { + return <<<'HTML' + +HTML; }); } }