1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace App\Exceptions\Form;
- use Dcat\Admin\Support\Helper;
- use Dcat\Admin\Form\Field\Image;
- use PhpParser\Node\Expr\Cast\Double;
- class MultipleCutImage extends Image
- {
- protected $view = 'admin.form_custom.cut-image';
-
- public function sortable(bool $value = true)
- {
- $this->options['sortable'] = $value;
- return $this;
- }
-
- public function aspectRatio(float $value = 1)
- {
- $this->options['aspectRatio'] = $value;
- return $this;
- }
-
- public function limit(int $limit)
- {
- if ($limit < 2) {
- return $this;
- }
- $this->options['fileNumLimit'] = $limit;
- return $this;
- }
-
- protected function prepareInputValue($file)
- {
- if ($path = request(static::FILE_DELETE_FLAG)) {
- $this->deleteFile($path);
- return array_values(array_diff($this->original, [$path]));
- }
- $file = Helper::array($file, true);
- $this->destroyIfChanged($file);
- return $file;
- }
- protected function forceOptions()
- {
- }
- }
|