Skip to content

Commit

Permalink
fix media field
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Aug 3, 2022
1 parent 0cbdc25 commit fdf9c6f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/Fields/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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}
*/
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ abstract class Root
*
* @var string
*/
public const VERSION = '0.6.1';
public const VERSION = '0.6.2';

/**
* The registered callbacks.
Expand Down

0 comments on commit fdf9c6f

Please sign in to comment.