| @@ 57-66 (lines=10) @@ | ||
| 54 | * @param bool $strict |
|
| 55 | * @return static |
|
| 56 | */ |
|
| 57 | public function options($options, $strict = false) |
|
| 58 | { |
|
| 59 | return $this->addChildren($options, function ($text, $value) use ($strict) { |
|
| 60 | if (is_array($text)) { |
|
| 61 | return $this->optgroup($value, $text, $strict); |
|
| 62 | } |
|
| 63 | ||
| 64 | return $this->createOption($text, $value, $strict); |
|
| 65 | }); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * @param string $label |
|
| @@ 75-84 (lines=10) @@ | ||
| 72 | * |
|
| 73 | * @return static |
|
| 74 | */ |
|
| 75 | public function optgroup($label, $options, $strict = false) |
|
| 76 | { |
|
| 77 | return Optgroup::create() |
|
| 78 | ->label($label) |
|
| 79 | ->addChildren($options, function ($text, $value) use ($strict) { |
|
| 80 | return $this->createOption($text, $value, $strict); |
|
| 81 | }); |
|
| 82 | ||
| 83 | return $this->addChild($optgroup); |
|
| 84 | } |
|
| 85 | ||
| 86 | /** |
|
| 87 | * @param string|null $text |
|