Skip to content
Discussion options

You must be logged in to vote

EDIT:
The package uses an observer on the Eloquent model. This is where the deletion of files take place.

My guess is that, in order for this to work, you need to call delete() directly on an instance of your media model, and not on the query builder as you do it in your example. I think you need a real Eloquent instance to call the delete() method on in order for the observer to be triggered.

Does this work?

Media::find($request->get('document_id'))->delete();

Original reply:
In my controller, I call

Media::find($request->input('photo'))->delete();

to delete a media from its ID.

Otherwise, I see that the InteractsWithMedia trait contains these two methods:

/**
 * Delete the associated m…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@mattpramschufer
Comment options

Comment options

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