Skip to content

attachments() returning empty collection #64

@christineRN

Description

@christineRN

I'm having a problem retrieving the list of attachments from my richTextAttribute so I can delete them when the related model instance is deleted.

Here are the details:

I'm writing an app using Livewire and stancl/tenancy and have a model that has a richTextAttribute called $message.

Image

I have followed your instructions for allowing file uploads into this attribute and that all seems to be working as expected.

Image Image

The attachments render correctly when viewing the saved model instance:

Image

When the user deletes a model instance, I need to ensure that files they uploaded into $message also get deleted on the filesystem.

Image

Unfortunately, when I call $message->attachments() I get an empty collection.

Image

I have also tried calling $message->attachments() in the actual delete() method when deleting a Result (rather than in the ResultObserver in case this was caused by the richTextAttribute having already been deleted by the time ResultObserver was running), but the output is the same.

Any suggestions?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions