This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Description
If I have something like this
class Post extends Model
{
public function comments(): HasMany
{
return $this->hasMany(Comment::class)->select('body');
}
}
class Comment extends Model
{
public function attachments(): HasMany
{
return $this->hasMany(Attachment::class);
}
}
Comment
just has an empty attachments
array. I know, why this happens and that I can solve this, by adding 'id' to the 'select()` method call, but wouldn't it be good if Eloquent knew that it needs this key? Since there's no error message, the mistake is everything but obvious due to the abstraction Laravel and Eloquent have.