Skip to content

Commit 5410ab9

Browse files
committed
Finalized release
1 parent e2ffb6b commit 5410ab9

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
## v1.0.4 (2025-03-22)
2+
### Added
3+
* Support for IDs: Added support for adding `id` attributes to the selectable items using the `withId` method.
4+
5+
### Improved
6+
* `withDataAttribute` method: Added support for passing a Closure to the `withDataAttribute` method to generate the data attribute value dynamically.
7+
* `withClass` method: Added support for passing an array of classes to the `withClass` method to add multiple classes to the selectable items.
8+
* Performance optimization option rendering
9+
10+
## v1.0.3 (2024-11-09)
11+
### Added
12+
* Support for non-object (array) collections
13+
14+
### Added
15+
* Support for IDs: Added support for adding IDs to the selectable items using the `withId` method.
16+
17+
18+
## v1.0.2 (2024-07-02)
19+
### Added
20+
* Introduced custom IDE helper file
21+
122
## v1.0.1 (2024-05-21)
223

324
### Added

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,22 @@ other than '`active`', and a custom class '`form-option custom`' will be applied
116116

117117
#### Available methods
118118

119-
- `withLabel(string|callable $label)`: This method allows you to customize the label for each option. A string will be
120-
used as the collection field from which the label will be generated, while a callable will be used to generate the
119+
- `withLabel(string|Closure $label)`: This method allows you to customize the label for each option. A string will be
120+
used as the collection field from which the label will be generated, while a Closure will be used to generate the
121121
label.
122-
- `withValue(string|callable $value)`: This method allows you to customize the value for each option. A string will be
123-
used as the collection field from which the value will be generated, while a callable will be used to generate the
122+
- `withValue(string|Closure $value)`: This method allows you to customize the value for each option. A string will be
123+
used as the collection field from which the value will be generated, while a Closure will be used to generate the
124124
value.
125-
- `withSelected(mixed|callable $selected)`: This method allows you to customize the selected options. Can be
126-
a `string`, `int`, an array of `string`/`int`, a `model` or a callable that returns a boolean value.
127-
- `withDisabled(mixed|callable $disabled)`: This method allows you to customize the disabled options. Can be
128-
a `string`, `int`, an array of `string`/`int`, a `model` or a callable that returns a boolean value.
129-
- `withDataAttribute(string $attribute, mixed|callable $value)`: This method allows you to add a data attribute to each
130-
option.
131-
- `withClass(string $class)`: This method allows you to add a class to each option.
132-
- `toSelectItems()`: This method converts the selectable collection to an array of selectable items. Useful for Ajax
133-
responses or SPA.
125+
- `withSelected(mixed|Closure $selected)`: This method allows you to customize the selected options. Can be
126+
a `string`, `int`, an array of `string`/`int`, a `model` or a `Closure` that returns a `boolean` value.
127+
- `withDisabled(mixed|Closure $disabled)`: This method allows you to customize the disabled options. Can be
128+
a `string`, `int`, an array of `string`/`int`, a `model` or a `Closure` that returns a `boolean` value.
129+
- `withDataAttribute(string|Closure $attribute, mixed|Closure $value)`: This method allows you to add a data attribute to each
130+
option. The first parameter can be a `string` or a `Closure` that returns a `string` which will be attached as `data-{attribute}="{value}"` to the option. The second parameter can be any type convertable to a string or a `Closure` that returns a `string`.
131+
- `withId(string|Closure $id)`: This method allows you to add an `id` attribute to each option. The value can be a `Closure` that returns a unique `string` for each option.
132+
- `withClass(string|array|Closure $class)`: This method allows you to add a class to each option. The value can be a `string` or an `array` of `string` or a `Closure` that returns a `string`.
133+
- `toSelectItems()`: This method converts the selectable collection to an `array` of selectable items. Useful for Ajax
134+
responses or SPAs.
134135
- `toSelectOptions()`: This method converts the selectable collection to an HTML select options string.
135136
- Some of the methods from `Illuminate\Support\Collection` are also available including `groupBy()`.
136137

@@ -149,7 +150,7 @@ You can work with collections of non-object arrays both flat and associative
149150
```
150151

151152

152-
## Get Selectable Items
153+
## Getting Selectable Items
153154
```php
154155
$selectableItems = \App\Models\User::all()->toSelectable()->toSelectItems();
155156
```
@@ -173,7 +174,7 @@ Single Page Applications (SPAs).
173174

174175

175176
## Testing
176-
177+
To run tests, run the following command:
177178
```bash
178179
composer test
179180
```

0 commit comments

Comments
 (0)