From fdf9c6f7b91d178fa32e660c1a7b8e549d1c9136 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Wed, 3 Aug 2022 09:46:30 +0200 Subject: [PATCH] fix media field --- src/Fields/Media.php | 21 +++++++++++++++++++++ src/Root.php | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) 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.