tomatophp/filament-media-manager
Multi-Picker Support - Added collection name support for multiple pickers on the same page
collection_name column in media_has_models pivot table->collection('name') method to specify collection for each pickerMigration: 2024_10_21_000000_add_collection_name_to_media_has_models_table.php
collection_name (nullable string) columnresponsive_images (boolean, default false) columnUpdated Methods with Collection Support:
// Define separate collections for different pickers
Forms\Components\MediaManagerPicker::make('featured_image')
->collection('featured')
->single();
Forms\Components\MediaManagerPicker::make('gallery_images')
->collection('gallery')
->multiple();
// Retrieve media by collection
$product->getMediaManagerMedia('featured');
$product->getMediaManagerMedia('gallery');
$product->getMediaManagerUrl('featured');
$product->getMediaManagerUrls('gallery');
Spatie Media Library Integration - Added responsive images support using Spatie's built-in functionality
->responsiveImages() method on MediaManagerPickerNew Trait Methods for Responsive Images:
getMediaManagerResponsiveImages(?string $collectionName = null) - Get media with responsive image datagetMediaManagerSrcset(?string $collectionName = null) - Get srcset attribute for first mediagetMediaManagerSrcsets(?string $collectionName = null) - Get all srcset attributesgetMediaManagerResponsiveUrls(?string $collectionName = null) - Get responsive URLs for first mediagetAllMediaManagerResponsiveUrls(?string $collectionName = null) - Get all responsive URLsUsage Example:
// Enable responsive images
Forms\Components\MediaManagerPicker::make('hero_image')
->collection('hero')
->single()
->responsiveImages();
// In Blade templates
<img src="{{ $model->getMediaManagerUrl('hero') }}"
srcset="{{ $model->getMediaManagerSrcset('hero') }}"
alt="Hero Image">
// Get detailed responsive data
$responsiveImages = $model->getMediaManagerResponsiveImages('gallery');
// Returns: ['media' => $media, 'url' => $url, 'responsive_urls' => [...], 'srcset' => '...']
Drag & Drop Reordering - Added drag and drop functionality to reorder media items in MediaManagerPicker
Order Column Support - Added order_column to media_has_models pivot table
2024_10_20_000000_add_order_column_to_media_has_models_table.phpOrder Persistence
attachMediaManagerMedia()syncMediaManagerMedia()getMediaManagerMedia() callsFixed: Media selection not being set to form - Resolved inconsistent event detail structure
{ media: ... }isProcessing flagFixed: Reordering persistence - Completely rewrote view logic for reliable drag & drop
wire:key for proper Livewire DOM trackingCollection Name Parameter - Changed getMediaManagerUrl() and getMediaManagerUrls() methods
$conversion parameter for image transformations$collectionName parameter to filter by media collectionUpdated Methods with Ordering:
// Now returns media in order
$product->getMediaManagerMedia('gallery');
$product->getMediaManagerUrl('thumbnails'); // Get first from thumbnails collection
$product->getMediaManagerUrls('documents'); // Get all URLs from documents collection
// Order is preserved when syncing
$product->syncMediaManagerMedia(['uuid-3', 'uuid-1', 'uuid-2']);
media_has_models table:
order_column (unsigned integer, nullable, indexed)resources/views/forms/media-manager-picker.blade.php
wire:key for DOM trackingsrc/Form/MediaManagerPicker.php
$collectionName property and collection() method$generateResponsiveImages property and responsiveImages() methodshouldGenerateResponsiveImages() getter methodafterStateHydrated(): Now loads and sorts media by order_column and filters by collection_namesaveRelationshipsUsing(): Saves media with sequential order values, collection name, and responsive images flagsrc/Traits/InteractsWithMediaManager.php
$collectionName parametergetMediaManagerMedia(?string $collectionName): Filters by collection name and returns sorted by orderattachMediaManagerMedia(array $uuids, ?string $collectionName): Supports collection-specific attachmentsdetachMediaManagerMedia(?array $uuids, ?string $collectionName): Supports collection-specific detachmentsyncMediaManagerMedia(array $uuids, ?string $collectionName): Collection-aware sync operationhasMediaManagerMedia(string $uuid, ?string $collectionName): Collection-aware existence checkgetFirstMediaManagerMedia(?string $collectionName): Returns first from specific collectiongetMediaManagerUrl(?string $collectionName): Gets URL from specific collectiongetMediaManagerUrls(?string $collectionName): Gets all URLs from specific collectiongetMediaManagerResponsiveImages(?string $collectionName): Get media with responsive datagetMediaManagerSrcset(?string $collectionName): Get srcset for first mediagetMediaManagerSrcsets(?string $collectionName): Get all srcsetsgetMediaManagerResponsiveUrls(?string $collectionName): Get responsive URLs for first mediagetAllMediaManagerResponsiveUrls(?string $collectionName): Get all responsive URLssrc/Livewire/MediaPicker.php
selectMedia(): Fixed event detail structure with consistent wrappinggetMediaManagerUrl(?string $collectionName = null) - Parameter changed from $conversion to $collectionNamegetMediaManagerUrls(?string $collectionName = null) - Parameter changed from $conversion to $collectionNameIf upgrading from v4.0.0 or v4.0.2:
Run the new migrations:
php artisan migrate
This will add:
order_column (if upgrading from v4.0.0)collection_name columnresponsive_images columnUpdate trait method calls if using conversions:
// Old (v4.0.0)
$product->getMediaManagerUrl('thumb'); // Got thumbnail conversion
// New (v4.0.3)
$product->getMediaManagerUrl('gallery'); // Gets first from 'gallery' collection
// For conversions, use Spatie directly:
$media = $product->getFirstMediaManagerMedia('gallery');
$thumbnailUrl = $media?->getUrl('thumb');
Using multiple pickers on the same page:
// Now you can use collection names to separate pickers
Forms\Components\MediaManagerPicker::make('featured_image')
->collection('featured')
->single();
Forms\Components\MediaManagerPicker::make('gallery_images')
->collection('gallery')
->multiple();
// Each will maintain separate media attachments
Using responsive images:
// Enable responsive images
Forms\Components\MediaManagerPicker::make('hero_image')
->collection('hero')
->responsiveImages();
// Retrieve responsive images
$srcset = $model->getMediaManagerSrcset('hero');
Backward Compatibility:
order_column values will still work (nullable column). Order will be applied on next save.collection_name will work as before (defaults to null)->responsiveImages() methodFull Changelog: https://github.com/tomatophp/filament-media-manager/compare/v4.0.2...v4.0.3
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v4.0.1...v4.0.2
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v4.0.0...v4.0.1
This major version brings full compatibility with Filament v4 along with significant improvements to the MediaManagerPicker component and new model integration features.
Enhanced UI/UX
Selection Management
->single() and ->multiple()->maxItems(n) to limit maximum selections->minItems(n) to enforce minimum selectionsFile Upload in Modal
Password Protected Folders
Search & Navigation
getMediaManagerMedia() - Get all attached mediagetMediaManagerMediaByUuids() - Get specific media by UUIDsgetMediaManagerInputMedia() - Get Spatie collection mediaattachMediaManagerMedia() - Attach media programmaticallydetachMediaManagerMedia() - Detach mediasyncMediaManagerMedia() - Sync media (replace all)hasMediaManagerMedia() - Check if media existsgetFirstMediaManagerMedia() - Get first media itemgetMediaManagerUrl() - Get media URL with conversionsgetMediaManagerUrls() - Get all media URLsdocs/TRAITS.md->storeFiles(false) and passing files directly to Spatie Media LibrarywhereIn query by adding flatten() filterisProcessing flag{media: array} and direct array)mountedActions array properlyfi-ta-empty-state).classname:where(.dark,.dark *) patternvar(--gray-950))$wire.set() usage for state managementsrc/Livewire/MediaPicker.php - Enhanced with password protection, upload, selection managementsrc/Form/MediaManagerPicker.php - Added remove action, browse action improvementsresources/views/livewire/media-picker.blade.php - Complete UI overhaulresources/views/forms/media-manager-picker.blade.php - Preview list, empty state, event handlingresources/views/components/media-picker-modal.blade.php - Initial state supportresources/lang/en/messages.php - Added new translation keysresources/lang/ar/messages.php - Added Arabic translationssrc/Traits/InteractsWithMediaManager.php - New trait for model integrationdocs/TRAITS.md - Trait documentationCHANGELOG.md - This changelogtests/src/MediaManagerPickerTest.php - Comprehensive MediaManagerPicker teststests/src/MediaManagerInputTest.php - Comprehensive MediaManagerInput teststests/src/InteractsWithMediaManagerTest.php - Trait functionality teststests/src/Models/Product.php - Test model with media supporttests/database/factories/ProductFactory.php - Product factory for testingtests/database/migrations/2025_10_07_000001_create_products_table.php - Products table migrationtests/README.md - Testing documentation and guideFull Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.1.6...v4.0.0
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.1.5...v1.1.6
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.1.4...v1.1.5
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.1.3...v1.1.4
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.1.1...v1.1.2
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.1.0...v1.1.1
now you can allow user to access selected folder and restract user to access each other folders if the folder is not public on /app/Providers/Filament/AdminPanelProvider.php
->plugin(
\TomatoPHP\FilamentMediaManager\FilamentMediaManagerPlugin::make()
->allowUserAccess()
)
NOTE don't forget to migrate after update the plugin
now you can access your media and folders using API you have 2 endpoints
/api/folders to get all folders/api/folders/{id} to get folder by id with sub folders and media filesto allow this feature you need to publish the config file by use this command
php artisan vendor:publish --tag="filament-media-manager-config"
then you can set api.active to true on the config file
'api' => [
"active" => true,
],
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.10...v1.1.0
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.9...v1.0.10
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.8...v1.0.9
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.7...v1.0.8
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.6...v1.0.7
fix multi types
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.5...v1.0.6
remove a link from the custom preview
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.4...v1.0.5
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.3...v1.0.4
Full Changelog: https://github.com/tomatophp/filament-media-manager/compare/v1.0.2...v1.0.3
How can I help you explore Laravel packages today?