Fix media data

This commit is contained in:
philipp lang 2024-11-13 13:19:00 +01:00
parent 77cfe9bbc7
commit e9975e9c5a
3 changed files with 6 additions and 6 deletions

View File

@ -31,7 +31,7 @@ class DeferredMediaData extends Data
public static function collectionFromPaths(Collection $paths, MediaCollection $collection): DataCollection
{
return static::collection($paths->map(fn ($path) => static::fromPath($path, $collection)));
return static::collect($paths->map(fn ($path) => static::fromPath($path, $collection)));
}
public function with(): array

View File

@ -66,7 +66,7 @@ class MediaController
$collection->runCallback('after', $model->fresh());
return $isSingle ? MediaData::from($medias->first()) : MediaData::collection($medias);
return $isSingle ? MediaData::from($medias->first()) : MediaData::collect($medias);
}
protected function storeDeferred(Request $request)
@ -98,7 +98,7 @@ class MediaController
});
$this->authorize('storeMedia', [$modelName, null, $collection->name]);
return $isSingle ? DeferredMediaData::fromPath($tempPaths->first(), $collection) : DeferredMediaData::collectionFromPaths($tempPaths, $collection);
return $isSingle ? DeferredMediaData::fromPath($tempPaths->first(), $collection) : DeferredMediaData::collect($tempPaths, $collection);
}
public function update(Request $request, Media $media): MediaData
@ -132,7 +132,7 @@ class MediaController
return $isSingle
? MediaData::from($model->getFirstMedia($collectionName))
: MediaData::collection($model->getMedia($collectionName));
: MediaData::collect($model->getMedia($collectionName));
}
public function destroy(Media $media, Request $request): JsonResponse

View File

@ -31,6 +31,6 @@ class OrderController
$model->getMediaCollection($collectionName)->runCallback('after', $model->fresh());
return MediaData::collection($model->getMedia($collectionName));
return MediaData::collect($model->getMedia($collectionName));
}
}