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 classes as extra attributes #3537

Closed pascalbaljet closed 9 months ago

pascalbaljet commented 9 months ago

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

Media::first()->img('thumb', ['class' => [
    'rounded',
    'border' => true,
    'border-black' => false,
]]),

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

freekmurze commented 9 months ago

Very nice! Could you also put an example of this in the docs?

pascalbaljet commented 9 months ago

@freekmurze done :)

freekmurze commented 9 months ago

Very nice, thanks!