-
Notifications
You must be signed in to change notification settings - Fork 43
Closed
Description
Hi.
First, let me say - great idea with filters. Looks nice.
How would you go about show/hide accessor data or some other custom data derivative?
Lets use simple User example.
// accessor
public function getFullNameAttribute()
{
return $this->first_name . ' ' . $this->last_name;
}
public function getAgeAttribute()
{
return Carbon::parse($this->attributes['birthday'])->age;
}I would like to allow user to toggle some fields that are not stored in model
/users?with=full_name,age
I have implemented a solution based on JsonResource and with custom mergeWhen logic but I would like to hear your input with EloquentBuilder.
I know about appends - but I do not want to always include that data in all responses.
protected $appends = ['age'];Metadata
Metadata
Assignees
Labels
No labels