Open JaviLerma opened 1 month ago
Greetings from Argentina! The Official docs says:
QueryBuilder::for(Post::class) ->allowedFields('author.id', 'author.name') ->allowedIncludes('author') ->get();
GET /posts?include=author&fields[author]=id,name
Return all post but only id and name of the author, but it doesn't work. It fetches all the authors fields.
Relationships
User model:
public function posts(): HasMany { return $this->hasMany(Post::class, 'author_id'); }}
Post model:
public function author(): BelongsTo { return $this->belongsTo(User::class, 'author_id'); }
I am doing something wrong or its a bug? Thanks
Estou passando pelo mesmo problema, não sei como resolver ainda.
Greetings from Argentina! The Official docs says:
GET /posts?include=author&fields[author]=id,name
Return all post but only id and name of the author, but it doesn't work. It fetches all the authors fields.
Relationships
User model:
Post model:
I am doing something wrong or its a bug? Thanks