Skip to content
Discussion options

You must be logged in to vote

I think this is what I needed, where $media is a single media item, so if your collection has more then one item, you would need to loop over the $model->media collection:

Storage::disk($media->disk)->exists($media->getPath()) // bool

Possiblly:

Storage::disk($media->disk)->exists($media->getPathRelativeToRoot()) // bool

I'm not sure when the two path values would differ - they are both identical for me - so I will assume one will be wrong in certain contexts. I always thought Flysystem paths already were always relative to the root of the filesystem, so 🤷 .

Again, it would be nice if this were wrapped up in $media->fileExists(), though I could imagine options to select for the conversi…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by judgej
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant