| @@ 168-189 (lines=22) @@ | ||
| 165 | * |
|
| 166 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
| 167 | */ |
|
| 168 | public function render() |
|
| 169 | { |
|
| 170 | $this->setupDefaultOptions(); |
|
| 171 | ||
| 172 | if (!empty($this->value)) { |
|
| 173 | $this->attribute('data-initial-preview', $this->preview()); |
|
| 174 | ||
| 175 | $this->setupPreviewOptions(); |
|
| 176 | } |
|
| 177 | ||
| 178 | $this->options(['overwriteInitial' => true]); |
|
| 179 | ||
| 180 | $options = json_encode($this->options); |
|
| 181 | ||
| 182 | $this->script = <<<EOT |
|
| 183 | ||
| 184 | $("input{$this->getElementClassSelector()}").fileinput({$options}); |
|
| 185 | ||
| 186 | EOT; |
|
| 187 | ||
| 188 | return parent::render(); |
|
| 189 | } |
|
| 190 | } |
|
| 191 | ||
| @@ 204-222 (lines=19) @@ | ||
| 201 | * |
|
| 202 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
|
| 203 | */ |
|
| 204 | public function render() |
|
| 205 | { |
|
| 206 | $this->attribute('multiple', true); |
|
| 207 | ||
| 208 | $this->setupDefaultOptions(); |
|
| 209 | ||
| 210 | if (!empty($this->value)) { |
|
| 211 | $this->options(['initialPreview' =>$this->preview()]); |
|
| 212 | $this->setupPreviewOptions(); |
|
| 213 | } |
|
| 214 | ||
| 215 | $options = json_encode($this->options); |
|
| 216 | ||
| 217 | $this->script = <<<EOT |
|
| 218 | $("input{$this->getElementClassSelector()}").fileinput({$options}); |
|
| 219 | EOT; |
|
| 220 | ||
| 221 | return parent::render(); |
|
| 222 | } |
|
| 223 | ||
| 224 | /** |
|
| 225 | * Destroy original files. |
|