Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Sep 18, 2022
1 parent dd72f3e commit c696359
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Fields/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,17 @@ public function mapOption(RootRequest $request, Model $model, Model $related): a
{
$relation = $this->getRelation($model);

$pivot = $related->relationLoaded($relation->getPivotAccessor())
? $related->getRelation($relation->getPivotAccessor())
: $relation->newPivot();

return array_merge(
parent::mapOption($request, $model, $related),
$related->append(['dimensions', 'formatted_size'])->toArray(),
[
'fields' => $this->resolveFields($request)
->available($request, $model, $related)
->mapToForm($request, $relation->newPivot())
->mapToForm($request, $pivot)
->toArray(),
'formatted_created_at' => $related->created_at->format('Y-m-d H:i'),
],
Expand Down
2 changes: 1 addition & 1 deletion src/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class Root
*
* @var string
*/
public const VERSION = '0.9.0';
public const VERSION = '0.9.1';

/**
* The registered callbacks.
Expand Down

0 comments on commit c696359

Please sign in to comment.