laravel-orion icon indicating copy to clipboard operation
laravel-orion copied to clipboard

[Feature Request] setAppends

Open ldiebold opened this issue 4 years ago • 1 comments

This may be something more suited to userland, yet I thought it was worth asking!

Sometimes, we want to include attributes in our request. Laravel allows us to automatically append these attributes with appends

protected $appends = ['is_admin'];

However, often we only want those attributes on occassion. So My feature request is this. Allow the developer to have an appends array on the Controller, similar to how we currently use includes

  protected function appends() : array
  {
      return ['is_admin'];
  }

Then we can use the following query to only append what we need:

(GET) https://myapp.com/api/users?appends=is_admin

Thoughts? :smiley:

ldiebold avatar Dec 23 '20 03:12 ldiebold

Hi @ldiebold,

This is a good one! I will put it on the roadmap 👌

alexzarbn avatar Dec 23 '20 14:12 alexzarbn