Skip to content

Hide "path" attribute when returning Attachment models #184

@mitchkramez

Description

@mitchkramez

Our API returns some images that have been uploaded, but for the public API, we'd like to hide the path attribute from the content and only include the url. Obviously we can filter this out manually, but was hoping there was a way to not return this. We've tried setting a $hidden on the model to no avail:

"image": {
    "medium": {
        "path": "/vhosts/domain.dev/httpdocs/public/images/medium/missing.png",
        "url": "/images/medium/missing.png"
    },
    "thumb": {
        "path": "/vhosts/domain.dev/httpdocs/public/images/thumb/missing.png",
        "url": "/images/thumb/missing.png"
    },
    "original": {
        "path": "/vhosts/domain.dev/httpdocs/public/images/original/missing.png",
        "url": "/images/original/missing.png"
    }
}

Is there a simpler way to hide this attribute?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions