Skip to content

Commit 6311af0

Browse files
authored
Adapt to Livewire 3 folder structure (#17)
1 parent c28e99c commit 6311af0

File tree

3 files changed

+12
-22
lines changed

3 files changed

+12
-22
lines changed

README.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ typing.
1515

1616
You will no longer need to download all the data at the startup, just get the data you're looking for.
1717

18-
## Requirements
19-
20-
**This package requires AlpineJS to work properly.**
21-
22-
If you're not going to use AlpineJS, you might want to publish the component view in order to replace the AlpineJS functionality.
23-
24-
```bash
25-
php artisan vendor:publish --provider="SertxuDeveloper\Livewire\LivewireComboboxServiceProvider"
26-
```
27-
2818
## Installation
2919

3020
You can install the package via composer:
@@ -43,14 +33,14 @@ First, you need to execute the following command in your terminal:
4333
php artisan combobox:make UsersCombobox -m User
4434
```
4535

46-
This will create a new component in the `App/Http/Livewire` directory.
36+
This will create a new component in the `app/Livewire` directory.
4737

4838
The new `UsersCombobox` component will look like this:
4939

5040
```php
5141
<?php
5242

53-
namespace App\Http\Livewire;
43+
namespace App\Livewire;
5444

5545
use App\Models\User;
5646
use SertxuDeveloper\LivewireCombobox\Components\Combobox;
@@ -95,7 +85,7 @@ You can also pass some parameters to the component:
9585
<livewire:users-combobox name="author" label="Author" placeholder="Select a user">
9686
```
9787

98-
> **Warning**<br>
88+
> [!WARNING]
9989
> If you don't pass any parameters, the component will use the default values.<br>
10090
> It's recommended to pass the parameters to the component.<br>
10191
> 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
111101

112102
These events will be fired up, so the parent component can react to the user interaction.
113103

114-
> **Note**<br>
104+
> [!Note]
115105
> The `selected` event contains the selected model as a parameter.
116106
117107
## Adding filters

src/Console/ComboboxMakeCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function buildClass($name): string {
5151
* @param string $rootNamespace
5252
*/
5353
protected function getDefaultNamespace($rootNamespace): string {
54-
return $rootNamespace.'\Http\Livewire';
54+
return $rootNamespace.'\Livewire';
5555
}
5656

5757
/**

tests/Console/ComboboxMakeCommandTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public function test_command_can_be_executed(): void {
1515
'name' => 'TestCombobox',
1616
]);
1717

18-
$this->assertFileExists(app_path('Http/Livewire/TestCombobox.php'));
19-
unlink(app_path('Http/Livewire/TestCombobox.php'));
18+
$this->assertFileExists(app_path('Livewire/TestCombobox.php'));
19+
unlink(app_path('Livewire/TestCombobox.php'));
2020
}
2121

2222
/**
@@ -28,8 +28,8 @@ public function test_command_can_be_executed_with_model_option(): void {
2828
'--model' => 'User',
2929
]);
3030

31-
$this->assertFileExists(app_path('Http/Livewire/TestModelCombobox.php'));
32-
unlink(app_path('Http/Livewire/TestModelCombobox.php'));
31+
$this->assertFileExists(app_path('Livewire/TestModelCombobox.php'));
32+
unlink(app_path('Livewire/TestModelCombobox.php'));
3333
}
3434

3535
/**
@@ -41,12 +41,12 @@ public function test_command_generates_correct_file(): void {
4141
'--model' => 'User',
4242
]);
4343

44-
$contents = file_get_contents(app_path('Http/Livewire/TestModelCombobox.php'));
44+
$contents = file_get_contents(app_path('Livewire/TestModelCombobox.php'));
4545

4646
$this->assertStringContainsString('class TestModelCombobox extends Combobox', $contents);
4747
$this->assertStringContainsString('use App\Models\User;', $contents);
4848

49-
unlink(app_path('Http/Livewire/TestModelCombobox.php'));
49+
unlink(app_path('Livewire/TestModelCombobox.php'));
5050
}
5151

5252
/**
@@ -60,6 +60,6 @@ public function test_command_cannot_be_executed_with_invalid_model(): void {
6060
'--model' => 'User-*Invalid\\Model',
6161
]);
6262

63-
$this->assertFileDoesNotExist(app_path('Http/Livewire/TestModelCombobox.php'));
63+
$this->assertFileDoesNotExist(app_path('Livewire/TestModelCombobox.php'));
6464
}
6565
}

0 commit comments

Comments
 (0)