spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.78k stars 1.08k forks source link

Support for passing an array of styles as extra attributes #3542

Closed misaf closed 9 months ago

misaf commented 9 months ago

This PR adds support for passing an array of styles when rendering a Media Model:

Media::first()->img('thumb', ['styles' => [
    'background-color: blue',
    'color: blue'
]]),

Under the hood, it uses Laravel's Arr::toCssStyles helper method.

freekmurze commented 9 months ago

Could you add a tests and documentation for this?

misaf commented 9 months ago

Sure, I'll make sure to add tests and documentation for this feature.

misaf commented 9 months ago

Tests and documentation have been added as requested.

freekmurze commented 9 months ago

It seems the tests are failing. Could you have a look?

misaf commented 9 months ago

All tests are green!

freekmurze commented 9 months ago

Thanks!