CodeSleeve / stapler

ORM-based file upload package for php.
http://codesleeve.com
Other
538 stars 144 forks source link

Hide "path" attribute when returning Attachment models #184

Open mitchkramez opened 7 years ago

mitchkramez commented 7 years ago

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?