Go to file
philipp lang 820a725517 Lint 2024-01-02 01:28:49 +01:00
src Lint 2024-01-02 01:27:56 +01:00
tests Lint 2024-01-02 01:28:49 +01:00
.gitignore Add icon to file 2023-03-10 12:47:14 +01:00
README.md Update README 2024-01-02 00:22:42 +01:00
composer.json Update tests 2024-01-02 00:41:22 +01:00
composer.lock Update tests 2024-01-02 00:41:22 +01:00
phpunit.xml Add tests 2023-03-07 15:31:24 +01:00

README.md

Laravel Medialibrary Helper

This package creates routes for the popular Medialibrary Package from Spatie ().

Available methods

In RegisterMediaCollections, you have the following methods available:

You can set a filename by default for the file. This accepts the associated Model, as well as the original filename. You should return the new name of the file with the extension (e.g. disc.jpg).

forceFileName(fn ($model, $path) => Str::slug($path))

You can set a max width (in Pixels) for images. This will resize the image BEFORE any normal Medialibrary conversions take place.

maxWidth(fn () => 2500)

You can call whatever you want after an image has been added, modified or deleted.

->after(function ($model) {
    ....
})