diff --git a/src/DeferredMediaData.php b/src/DeferredMediaData.php index 9891556..4262384 100644 --- a/src/DeferredMediaData.php +++ b/src/DeferredMediaData.php @@ -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 diff --git a/src/MediaController.php b/src/MediaController.php index 628eff9..85aa46c 100644 --- a/src/MediaController.php +++ b/src/MediaController.php @@ -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 diff --git a/src/OrderController.php b/src/OrderController.php index ad939d7..f526ab3 100644 --- a/src/OrderController.php +++ b/src/OrderController.php @@ -16,7 +16,7 @@ class OrderController $mediaCount = collect($request->order)->map(function ($media) { $media = Media::findOrFail($media); - return $media->model_id.'_'.$media->model_type; + return $media->model_id . '_' . $media->model_type; })->unique()->count(); if (1 !== $mediaCount) { @@ -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)); } }