| @@ 110-128 (lines=19) @@ | ||
| 107 | /** |
|
| 108 | * @return Model |
|
| 109 | */ |
|
| 110 | public function getOptionsModel() |
|
| 111 | { |
|
| 112 | $model = $this->options; |
|
| 113 | ||
| 114 | if (is_string($model)) { |
|
| 115 | $model = app($model); |
|
| 116 | } |
|
| 117 | ||
| 118 | if (!($model instanceof Model)) { |
|
| 119 | throw new InvalidArgumentException( |
|
| 120 | sprintf( |
|
| 121 | 'Form select element options class must be instanced of "%s".', |
|
| 122 | Model::class |
|
| 123 | ) |
|
| 124 | ); |
|
| 125 | } |
|
| 126 | ||
| 127 | return $model; |
|
| 128 | } |
|
| 129 | ||
| 130 | /** |
|
| 131 | * 获取 options 标题字段 |
|
| @@ 119-137 (lines=19) @@ | ||
| 116 | /** |
|
| 117 | * @return Model |
|
| 118 | */ |
|
| 119 | public function getOptionsModel() |
|
| 120 | { |
|
| 121 | $model = $this->options; |
|
| 122 | ||
| 123 | if (is_string($model)) { |
|
| 124 | $model = app($model); |
|
| 125 | } |
|
| 126 | ||
| 127 | if (!($model instanceof Model)) { |
|
| 128 | throw new InvalidArgumentException( |
|
| 129 | sprintf( |
|
| 130 | 'Form select element options class must be instanced of "%s".', |
|
| 131 | Model::class |
|
| 132 | ) |
|
| 133 | ); |
|
| 134 | } |
|
| 135 | ||
| 136 | return $model; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * 获取 options 标题字段 |
|