Skip to content

Commit

Permalink
Added missing public function signatures from InteractsWithMedia to H…
Browse files Browse the repository at this point in the history
…asMedia interface
  • Loading branch information
korridor committed Nov 2, 2023
1 parent 6a69de3 commit 561a2b6
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 4 deletions.
60 changes: 58 additions & 2 deletions src/HasMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

namespace Spatie\MediaLibrary;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Support\Collection;
use Spatie\MediaLibrary\Conversions\Conversion;
use Spatie\MediaLibrary\MediaCollections\FileAdder;
use Spatie\MediaLibrary\MediaCollections\MediaCollection;
use Spatie\MediaLibrary\MediaCollections\MediaRepository;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
use Spatie\MediaLibraryPro\PendingMediaLibraryRequestHandler;
use Symfony\Component\HttpFoundation\File\UploadedFile;

/**
* @mixin \Illuminate\Database\Eloquent\Model
* @method void prepareToAttachMedia(Media $media, FileAdder $fileAdder)
* @property bool $registerMediaConversionsUsingModelInstance
* @property ?\Spatie\MediaLibrary\MediaCollections\MediaCollection $mediaCollections
*/
Expand All @@ -21,21 +24,74 @@ public function media(): MorphMany;

public function addMedia(string|UploadedFile $file): FileAdder;

public function addMediaFromRequest(string $key): FileAdder;

public function addMediaFromDisk(string $key, string $disk = null): FileAdder;

public function addFromMediaLibraryRequest(?array $mediaLibraryRequestItems): PendingMediaLibraryRequestHandler;

public function syncFromMediaLibraryRequest(?array $mediaLibraryRequestItems): PendingMediaLibraryRequestHandler;

public function addMultipleMediaFromRequest(array $keys): Collection;

public function addAllMediaFromRequest(): Collection;

public function addMediaFromUrl(string $url, array|string ...$allowedMimeTypes): FileAdder;

public function addMediaFromString(string $text): FileAdder;

public function addMediaFromBase64(string $base64data, array|string ...$allowedMimeTypes): FileAdder;

public function addMediaFromStream($stream): FileAdder;

public function copyMedia(string|UploadedFile $file): FileAdder;

public function hasMedia(string $collectionName = ''): bool;

public function getMedia(string $collectionName = 'default', array|callable $filters = []): Collection;

public function getMediaRepository(): MediaRepository;

public function getFirstMedia(string $collectionName = 'default', $filters = []): ?Media;

public function getFirstMediaUrl(string $collectionName = 'default', string $conversionName = ''): string;

public function getFirstTemporaryUrl(
DateTimeInterface $expiration,
string $collectionName = 'default',
string $conversionName = ''
): string;

public function getRegisteredMediaCollections(): Collection;

public function getMediaCollection(string $collectionName = 'default'): ?MediaCollection;

public function getFallbackMediaUrl(string $collectionName = 'default', string $conversionName = ''): string;

public function getFallbackMediaPath(string $collectionName = 'default', string $conversionName = ''): string;

public function getFirstMediaPath(string $collectionName = 'default', string $conversionName = ''): string;

public function updateMedia(array $newMediaArray, string $collectionName = 'default'): Collection;

public function clearMediaCollection(string $collectionName = 'default'): HasMedia;

public function clearMediaCollectionExcept(string $collectionName = 'default', array|Collection $excludedMedia = []): HasMedia;

public function deleteMedia(int|string|Media $mediaId): void;
public function addMediaConversion(string $name): Conversion;

public function addMediaCollection(string $name): MediaCollection;

public function deletePreservingMedia(): bool;

public function shouldDeletePreservingMedia(): bool;

public function loadMedia(string $collectionName);

public function addMediaConversion(string $name): Conversion;
public function prepareToAttachMedia(Media $media, FileAdder $fileAdder): void;

public function processUnattachedMedia(callable $callable): void;

public function registerMediaConversions(Media $media = null): void;

Expand Down
2 changes: 0 additions & 2 deletions src/InteractsWithMedia.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ public function addMediaFromUrl(string $url, array|string ...$allowedMimeTypes):

/**
* Add a file to the media library that contains the given string.
*
* @param string string
*/
public function addMediaFromString(string $text): FileAdder
{
Expand Down

0 comments on commit 561a2b6

Please sign in to comment.