Skip to content

Commit 8da7a1f

Browse files
authored
Update BootstrapForm.php
1 parent 71f75bb commit 8da7a1f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/BootstrapForm.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Watson\BootstrapForm;
44

55
use Illuminate\Support\Arr;
6+
use Illuminate\Support\Collection;
67
use Illuminate\Support\Str;
78
use Collective\Html\FormBuilder;
89
use Collective\Html\HtmlBuilder;
@@ -524,12 +525,16 @@ public function hidden(string $name, ?string $value = null, array $options = [])
524525
/**
525526
* Create a select box field.
526527
*/
527-
public function select(string $name, null|string|HtmlString $label = null, array $list = [], ?string $selected = null, array $options = []): string
528+
public function select(string $name, null|string|HtmlString $label = null, array|Collection $list = [], ?string $selected = null, array $options = []): string
528529
{
529530
$label = $this->getLabelTitle($label, $name);
530531

531532
$inputElement = isset($options['prefix']) ? $options['prefix'] : '';
532533

534+
if(gettype($list) == 'object' && get_class($list) == 'Illuminate\Support\Collection'){
535+
$list = $list->toArray();
536+
}
537+
533538
$options = $this->getFieldOptions($options, $name);
534539
$inputElement .= $this->form->select($name, $list, $selected, $options);
535540

0 commit comments

Comments
 (0)