diff --git a/README.md b/README.md index 93ec3a2..72e68b1 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,6 @@ typing. You will no longer need to download all the data at the startup, just get the data you're looking for. -## Requirements - -**This package requires AlpineJS to work properly.** - -If you're not going to use AlpineJS, you might want to publish the component view in order to replace the AlpineJS functionality. - -```bash -php artisan vendor:publish --provider="SertxuDeveloper\Livewire\LivewireComboboxServiceProvider" -``` - ## Installation You can install the package via composer: @@ -43,14 +33,14 @@ First, you need to execute the following command in your terminal: php artisan combobox:make UsersCombobox -m User ``` -This will create a new component in the `App/Http/Livewire` directory. +This will create a new component in the `app/Livewire` directory. The new `UsersCombobox` component will look like this: ```php ``` -> **Warning**
+> [!WARNING] > If you don't pass any parameters, the component will use the default values.
> It's recommended to pass the parameters to the component.
> You can also add the values overriding the default values in the class. @@ -111,7 +101,7 @@ The name of the events depends on the component name, this allows you to have mo These events will be fired up, so the parent component can react to the user interaction. -> **Note**
+> [!Note] > The `selected` event contains the selected model as a parameter. ## Adding filters diff --git a/src/Console/ComboboxMakeCommand.php b/src/Console/ComboboxMakeCommand.php index 787a145..8993932 100644 --- a/src/Console/ComboboxMakeCommand.php +++ b/src/Console/ComboboxMakeCommand.php @@ -51,7 +51,7 @@ protected function buildClass($name): string { * @param string $rootNamespace */ protected function getDefaultNamespace($rootNamespace): string { - return $rootNamespace.'\Http\Livewire'; + return $rootNamespace.'\Livewire'; } /** diff --git a/tests/Console/ComboboxMakeCommandTest.php b/tests/Console/ComboboxMakeCommandTest.php index 0bf107b..eb87ca3 100644 --- a/tests/Console/ComboboxMakeCommandTest.php +++ b/tests/Console/ComboboxMakeCommandTest.php @@ -15,8 +15,8 @@ public function test_command_can_be_executed(): void { 'name' => 'TestCombobox', ]); - $this->assertFileExists(app_path('Http/Livewire/TestCombobox.php')); - unlink(app_path('Http/Livewire/TestCombobox.php')); + $this->assertFileExists(app_path('Livewire/TestCombobox.php')); + unlink(app_path('Livewire/TestCombobox.php')); } /** @@ -28,8 +28,8 @@ public function test_command_can_be_executed_with_model_option(): void { '--model' => 'User', ]); - $this->assertFileExists(app_path('Http/Livewire/TestModelCombobox.php')); - unlink(app_path('Http/Livewire/TestModelCombobox.php')); + $this->assertFileExists(app_path('Livewire/TestModelCombobox.php')); + unlink(app_path('Livewire/TestModelCombobox.php')); } /** @@ -41,12 +41,12 @@ public function test_command_generates_correct_file(): void { '--model' => 'User', ]); - $contents = file_get_contents(app_path('Http/Livewire/TestModelCombobox.php')); + $contents = file_get_contents(app_path('Livewire/TestModelCombobox.php')); $this->assertStringContainsString('class TestModelCombobox extends Combobox', $contents); $this->assertStringContainsString('use App\Models\User;', $contents); - unlink(app_path('Http/Livewire/TestModelCombobox.php')); + unlink(app_path('Livewire/TestModelCombobox.php')); } /** @@ -60,6 +60,6 @@ public function test_command_cannot_be_executed_with_invalid_model(): void { '--model' => 'User-*Invalid\\Model', ]); - $this->assertFileDoesNotExist(app_path('Http/Livewire/TestModelCombobox.php')); + $this->assertFileDoesNotExist(app_path('Livewire/TestModelCombobox.php')); } }