Skip to content

Commit e115536

Browse files
committed
Completed support for non-object array collections
1 parent 09a2251 commit e115536

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,18 @@ other than '`active`', and a custom class '`form-option custom`' will be applied
137137
> <small><strong>Note:</strong> Writing queries within blade templates is not recommended. This is only for simplifying
138138
> demonstration</small>
139139
140+
### Non-object Array Collections
141+
You can work with collections of non-object arrays both flat and associative
142+
```php
143+
$array1 = ["First", "Second", "Third"];
144+
$array2 = ['first' => "First", 'second' => "Second", 'third' => "Third"];
145+
$array3 = [['name' => 'First', 'number' => 1],['name' => 'Second', 'number' => 2],['name' => 'Third', 'number' => 3]]
146+
$options = collect($array)->toSelectOptions();
147+
$options2 = collect($array2)->toSelectOptions();
148+
$options3 = collect($array3)->toSelectable()->withValue('number')->toSelectOptions();
149+
```
150+
151+
140152
## Get Selectable Items
141153
```php
142154
$selectableItems = \App\Models\User::all()->toSelectable()->toSelectItems();

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"name": "master"
5252
}
5353
},
54-
"version": "1.0.2",
54+
"version": "1.0.3",
5555
"minimum-stability": "dev",
5656
"prefer-stable": true
5757
}

0 commit comments

Comments
 (0)