Š 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago
Nathan Gross

Unique identifier for file upload (Spatie Media Library)? 🤷♂

Hello!

Quick context: First time poster here. I'm pretty new to Filament. I'm loving it so far. So much more capable (and fun to work with) than Nova! I'm more of a front-end designer so I always like con start with that because I sometimes miss things obvious to traditional devs

That said here is my current issue:

Gits:
https://gist.github.com/nathangross/fcd60c84a7b312b4b746f2fca8c01c0a

To build out custom pages, I'm using the Builder with a bunch of different blocks. One block (called ChapterBlock) I've got a bunch of fields (title, text, etc) including an image field. I'm using Spatie Media Library (package and filament plugin). It's working great so far, until I try to use it within this ChapterBlocks—specifically multiple instances on a single page.

I upload a unique image on each ChapterBlock but upon save, only to have 1 image uploaded to the media library and each chapter block shows the same image.

My question is, how do I set a sort of unique id for each instance of my block so I can ensure each block can have an image? Or is there a better way to handle this?

(Notice I'm trying to create a unique ID but that's not working)

Thanks in advance!
Gist
ChapterBlock.php
GitHub Gist: instantly share code, notes, and snippets.
ChapterBlock.php
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

spatie media library file upload load file
FilamentFFilament / ❓┊help
2y ago
Spatie Media Library File Upload replacing every uploaded file
FilamentFFilament / ❓┊help
3y ago
Spatie Media File Upload Issue
FilamentFFilament / ❓┊help
2y ago