Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: spatie/laravel-medialibrary
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 11.4.2
Choose a base ref
...
head repository: spatie/laravel-medialibrary
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 11.4.3
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on Feb 20, 2024

  1. Update CHANGELOG

    freekmurze authored and github-actions[bot] committed Feb 20, 2024
    Copy the full SHA
    703ca88 View commit details
  2. resolve media model from subject if available and enforce HasMedia co…

    …ntract (#3547)
    illambo authored Feb 20, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d36b8f2 View commit details
Showing with 17 additions and 2 deletions.
  1. +13 −0 CHANGELOG.md
  2. +2 −0 src/HasMedia.php
  3. +2 −2 src/MediaCollections/FileAdder.php
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,19 @@

All notable changes to `laravel-medialibrary` will be documented in this file

## 11.4.2 - 2024-02-20

### What's Changed

* Clarify that class is resolved using service container by @bram-pkg in https://github.com/spatie/laravel-medialibrary/pull/3548
* Fix DivisionByZeroError in File::getHumanReadable() by @ziming in https://github.com/spatie/laravel-medialibrary/pull/3549

### New Contributors

* @bram-pkg made their first contribution in https://github.com/spatie/laravel-medialibrary/pull/3548

**Full Changelog**: https://github.com/spatie/laravel-medialibrary/compare/11.4.1...11.4.2

## 11.4.1 - 2024-02-17

### What's Changed
2 changes: 2 additions & 0 deletions src/HasMedia.php
Original file line number Diff line number Diff line change
@@ -44,4 +44,6 @@ public function registerMediaConversions(?Media $media = null): void;
public function registerMediaCollections(): void;

public function registerAllMediaConversions(): void;

public function getMediaModel(): string;
}
4 changes: 2 additions & 2 deletions src/MediaCollections/FileAdder.php
Original file line number Diff line number Diff line change
@@ -237,7 +237,7 @@ public function toMediaCollectionFromRemote(string $collectionName = 'default',
throw FileIsTooBig::create($this->pathToFile, $storage->size($this->pathToFile));
}

$mediaClass = config('media-library.media_model');
$mediaClass = $this->subject?->getMediaModel() ?? config('media-library.media_model');
/** @var Media $media */
$media = new $mediaClass();

@@ -300,7 +300,7 @@ public function toMediaCollection(string $collectionName = 'default', string $di
throw FileIsTooBig::create($this->pathToFile);
}

$mediaClass = config('media-library.media_model');
$mediaClass = $this->subject?->getMediaModel() ?? config('media-library.media_model');
/** @var Media $media */
$media = new $mediaClass();