diff --git a/src/Fields/Media.php b/src/Fields/Media.php index a3329914..4f68d9d5 100644 --- a/src/Fields/Media.php +++ b/src/Fields/Media.php @@ -21,6 +21,13 @@ class Media extends MorphToMany */ protected bool $async = true; + /** + * Indicates if multiple items can be selected. + * + * @var bool + */ + protected bool $multiple = true; + /** * The Vue component. * @@ -43,6 +50,19 @@ public function async(bool $value = true): static return $this; } + /** + * Set the multiple attribute. + * + * @param bool $value + * @return $this + */ + public function multiple(bool $value = true): static + { + $this->multiple = $value; + + return $this; + } + /** * {@inheritdoc} */ @@ -249,6 +269,7 @@ public function toInput(RootRequest $request, Model $model): array ->toArray(), ]; }), + 'multiple' => $this->multiple, 'url' => URL::to($this->getUri()), 'selection' => $models->map(function (Model $related) use ($request, $model): array { return $this->mapOption($request, $model, $related); diff --git a/src/Root.php b/src/Root.php index 8241e91d..f5de1616 100644 --- a/src/Root.php +++ b/src/Root.php @@ -14,7 +14,7 @@ abstract class Root * * @var string */ - public const VERSION = '0.6.1'; + public const VERSION = '0.6.2'; /** * The registered callbacks.