Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appends preview_url and original_url to Media object #2625

Merged
merged 7 commits into from Oct 18, 2021

Conversation

dustinboling
Copy link
Contributor

@dustinboling dustinboling commented Oct 13, 2021

This fixes the following issues when using MediaLibrary Pro Vue components in an Inertia.js project.
It adds the missing preview_url and original_url attributes.

  • spatie/laravel-medialibrary-pro/issues/105
  • spatie/laravel-medialibrary-pro/issues/240
  • spatie/laravel-medialibrary-pro/issues/241
  • spatie/laravel-medialibrary-pro/issues/302
  • spatie/laravel-medialibrary-pro/issues/314

A big thanks to @PaolaRuby for the suggested solution.

Closes #2621

The Inertia::render method calls the toArray method on the MediaCollection. Without this toArray method, the Media objects were being returned without image preview URLs. Adding the toArray method fixes this issue.
Copy link
Member

@freekmurze freekmurze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems very nice!

src/MediaCollections/Models/Media.php Show resolved Hide resolved
@freekmurze freekmurze merged commit 26d4d3f into spatie:main Oct 18, 2021
@freekmurze
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pr for Inertia projects introduced breaking changes
2 participants